When I use slmgr /skms <URL> | cmd command in PowerShell it shows me a pop up that I must press the ok button after that I run slmgr /ato | cmd and again shows me another pop up that I press the ok button.
I don't want to press the ok button manually, can anybody help me if there is a solution for it, please?
I just disabled the uac in windows, but it does not help me.
What you are looking for is
cscript. By just executing a vbs script file, output gets sent to dialog boxes, which need your interaction.Using
cscript, the desired output gets printed to your current stdout:That doesn't have anything to do with UAC and you might consider re-activating it.
But why is that?
slmgris not a command nor is it an executable in windows. It's a script file written in VBScript. VBScript is a kind-of scripting version of VB, So it's good for your peace of mind not to deal with it too much.If you type in
slmgr /skms, what windows does is looking for a file named slmgr in its search paths (%PATH%), findingC:\Windows\System32\slmgr.vbsand deciding that, as its a.vbsfile, executingwscript.exewith the file path and your arguments as parameter is the right thing to do.WScript is the default interpreter for vbs files and just interprets the file and executes its code. On the other hand, there is
cscriptfor console scripts.If the author of the
.vbsfile decides to write a message to the user of their script, they usually use a statement likeAnd thats where your confusion starts:
Executing this script in cscript means that
Hello, World!is written to the console. (That's what you want to do)Executing the same script using wscript renders a message box with a OK button. You can easily reproduce it yourself by creating a vbs file with the above statement.
The difference between cscript and wscript is also discussed in this question:
Difference between wscript and cscript