MDL-SLMGR Right Click Shell Extension Tool™

Discussion in 'MDL Projects and Applications' started by Mr Jinje, Sep 9, 2012.

  1. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
  2. Gmas79

    Gmas79 MDL Novice

    Joined:
    Jan 16, 2012
    Messages:
    26
    Likes Received:
    11
    Trophy Points:
    0
    #22 Gmas79, Sep 7, 2013
    Last edited: Sep 7, 2013
    Error message
    Can not find script file "C:\Windows\system32\elevate.vbs".
    Copied elevate files into Windows.
     
  3. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
    #23 Mr Jinje, Sep 8, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    This is just the DLI command, but it should avoid the need for elevate files. Report back if successful. Want to know if it runs from a non-admin account with UAC enabled.

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\DLI]
    @="DLI"
    "icon"="shell32.dll,23"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\DLI\command]
    @="cmd /c start /b powershell -command \"$WID=[System.Security.Principal.WindowsIdentity]::GetCurrent();$WIP=new-object System.Security.Principal.WindowsPrincipal($WID);$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator;if ($WIP.IsInRole($adminRole)){}else{$newProcess = new-object System.Diagnostics.ProcessStartInfo 'PowerShell';$newProcess.Arguments = $myInvocation.MyCommand.Definition;$newProcess.Verb = 'runas';[System.Diagnostics.Process]::Start($newProcess);Write-Host 'Prompting for Elevation';exit;}wscript.exe C:\\Windows\\System32\\slmgr.vbs -dli\""
    
     
  4. Gmas79

    Gmas79 MDL Novice

    Joined:
    Jan 16, 2012
    Messages:
    26
    Likes Received:
    11
    Trophy Points:
    0
    Now working. With local account popup admin pass prompt.
     
  5. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
    #25 Mr Jinje, Sep 8, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
  6. Bornung1

    Bornung1 MDL Member

    Joined:
    Oct 9, 2010
    Messages:
    148
    Likes Received:
    39
    Trophy Points:
    10
    #26 Bornung1, Sep 11, 2014
    Last edited: Sep 11, 2014
    Works just fine :p thx
    I am on a windows 8.1 pro x64 dk system, and no problems. :)

    Will it be possible to add commands for office 2013 in the future?

    Like these: "cscript ospp.vbs /act" "cscript ospp.vbs /dstatus"

    Cheers :)
     
  7. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
    #27 Mr Jinje, Oct 3, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    @Bornung1, sure why not. Guessing this ospp.vbs is in system32, if not, you'll need a re-write.

    Code:
    [HKEY_CLASSES_ROOT\Directory\Background\Shell\OFFICE_KMS]
    "MUIVerb"="Office Activator"
    "SubCommands"="OFFICE_ACT;|;OFFICE_STATUS"
    "Icon"="cmd.exe"
    "Position"="top"
    "HasLUAShield"=""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OFFICE_ACT]
    @="Office Activation"
    "icon"="shell32.dll,104"
    "HasLUAShield"=""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OFFICE_ACT\command]
    @="cmd /c start /b powershell -command \"$WID=[System.Security.Principal.WindowsIdentity]::GetCurrent();$WIP=new-object System.Security.Principal.WindowsPrincipal($WID);$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator;if ($WIP.IsInRole($adminRole)){}else{$newProcess = new-object System.Diagnostics.ProcessStartInfo 'PowerShell';$newProcess.Arguments = $myInvocation.MyCommand.Definition;$newProcess.Verb = 'runas';[System.Diagnostics.Process]::Start($newProcess);Write-Host 'Prompting for Elevation';exit;}cscript.exe ospp.vbs -act\""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OFFICE_STATUS]
    @="Office Activation Status"
    "icon"="shell32.dll,104"
    "HasLUAShield"=""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OFFICE_STATUS\command]
    @="cmd /c start /b powershell -command \"$WID=[System.Security.Principal.WindowsIdentity]::GetCurrent();$WIP=new-object System.Security.Principal.WindowsPrincipal($WID);$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator;if ($WIP.IsInRole($adminRole)){}else{$newProcess = new-object System.Diagnostics.ProcessStartInfo 'PowerShell';$newProcess.Arguments = $myInvocation.MyCommand.Definition;$newProcess.Verb = 'runas';[System.Diagnostics.Process]::Start($newProcess);Write-Host 'Prompting for Elevation';exit;}cscript.exe ospp.vbs -dstatus\""
    
    


    If anyone running W10 finds any failures on the original SLMGR, let me know.
     
  8. Bornung1

    Bornung1 MDL Member

    Joined:
    Oct 9, 2010
    Messages:
    148
    Likes Received:
    39
    Trophy Points:
    10
    I can't get it to work.

    It says it needs the "cscript engine". Do you know what that means?
     
  9. Carlos Detweiller

    Carlos Detweiller MDL Spinning Tortoise

    Joined:
    Dec 21, 2012
    Messages:
    4,514
    Likes Received:
    4,541
    Trophy Points:
    150
    Is "Windows Scripting Host" enabled in Windows Features?
     
  10. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
    #30 Mr Jinje, Oct 6, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    The snip I posted few days ago needs a re-write. See at the end of both of the long lines, look for the word wscript try replacing with cscript. Then re-merge the settings. (they'll overwrite)

    Code:
    wscript.exe C:\\Windows\\System32\\ospp.vbs -dstatus\""
    Code:
    cscript.exe ospp.vbs -dstatus\""
    Also I deleted the windows path, as I hear the file is not stored there. My guess it must be on the path variable somewhere in MS Office Program folder.
     
  11. Bornung1

    Bornung1 MDL Member

    Joined:
    Oct 9, 2010
    Messages:
    148
    Likes Received:
    39
    Trophy Points:
    10
    Hi Mr.Jinje :)

    The only problem i have now, is when i use the (Office commands). The powershell windows opens and closes real quick, so i have no chance for reading the information. Is it not possible to keep the window open, so i can read what it says? Just like the windows commands.
     
  12. Mr Jinje

    Mr Jinje MDL Expert

    Joined:
    Aug 19, 2009
    Messages:
    1,773
    Likes Received:
    1,098
    Trophy Points:
    60
    #32 Mr Jinje, Oct 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Not sure, maybe try with cmd /k to leave the window open.

    Code:
    cmd /k cscript.exe ospp.vbs -dstatus\""
     
  13. Bornung1

    Bornung1 MDL Member

    Joined:
    Oct 9, 2010
    Messages:
    148
    Likes Received:
    39
    Trophy Points:
    10
    Thx mr. Jinje, will try it out. ;)
     
  14. ignore201

    ignore201 MDL Novice

    Joined:
    Jun 28, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
  15. jinvidia

    jinvidia MDL Member

    Joined:
    Aug 7, 2016
    Messages:
    180
    Likes Received:
    19
    Trophy Points:
    10
    Sir,
    Please re-write the script in full for office activation as in the case of windows activation. I have done all the changes as instructed by you. But still powershell assumes that ospp.vbs resides in windows\system32 folder. But you may not be unaware that ospp.vbs resides in the \Programfiles\Microsoft Office\office16 folder. Please re-write the script so that it works fine as in windows activation.

    And thanks for the wonderful job for the context menu activation options for windows. :worthy: