9 Replies Latest reply on Oct 3, 2013 4:48 PM by rmilligan

    Scripting slmgr.vbs?


      So the other day I was trying to activate someone's copy of windows, since whoever imaged their machine didn't do so, apparently. I could remote into the machine, but could not activate the license because the user didn't have sufficient permissions; and for some reason, when I tried to switch user, it would try to log me in, then just boot me straight off with no message or reason why.


      So, my fix was to do a run as different user on a command prompt, and used the slmgr.vbs -ipk LicenseKey and slmgr.vbs -ato commands. It was then I was wondering if I could script those into the tail end of our image deployment so that we can skip that step on post-deployment setup. I tried to do it as just


      REMEXEC0=slmgr.vbs -ipk LicenseKey

      REMEXEC1=slmgr.vbs -ato


      But it failed with some kind of error about it not being a proper WMI or something.


      Any thoughts?

        • 1. Re: Scripting slmgr.vbs?

          The specific failure might be a path issue.


          If you call "C:\Windows\System32\slmgr.vbs" it might work.


          Else you can always copy the parameters you mentioned in a txt file rename it .cmd and put it somewhere on a share and call an execute file within provisioning.

          1 of 1 people found this helpful
          • 2. Re: Scripting slmgr.vbs?

            Alright, I'll give that a try. I was talking with one of my teacher's about it, and while he didn't know much about LANDesk, he said that since the built in script file is a .ini, and the slmgr is a .vbs script, I may have to do a c-script call or something like that. I'll try that as well and see if I can't get it to work.

            • 3. Re: Scripting slmgr.vbs?

              Yes you can also do an execute file calling either cscript or wscript and then referencing slmgr.vbs in the command line of the executable call.


              That should also work but then you will have two steps in your provisioning template for this if you need both calls.

              • 4. Re: Scripting slmgr.vbs?

                I tried doing the cscript call, and put in the full path to the .vbs script, and in LANDesk it's returning as successful, but the computer is still showing that I have 3 days to activate windows =/

                • 5. Re: Scripting slmgr.vbs?

                  If you are doing this in OS Deployment, you can add the appropriate lines to the Pre-boot commands section of the script. The following is what we use in our OSD scripts to activate Office 2010 and Windows using KMS activation. You could also insert a line to change the product key ahead of the activations:


                  cscript //B slmgr.vbs /ato

                  cscript //B "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS" /act


                  If you switch to provisioning, here is a screenshot of a working Windows activation using the execute file action from one of our templates:



                  The working directory had to be set to system32. Hope this helps.



                  • 6. Re: Scripting slmgr.vbs?

                    Oh cool, I'll have to give that a try. Activating Microsoft Office is another thing we've been doing post-image, so if I can get that to automate, that would be pretty nice too.


                    Once question though, what does //B signify? Is that a value I'll have to alter to suit our network, or what?

                    • 7. Re: Scripting slmgr.vbs?

                      Essentially, it just suppresses errors and prompts. You may want to leave that out until you have verified functionality. I believe Windows activation leaves a prompt up on the screen if you don't include the //B switch.

                      • 8. Re: Scripting slmgr.vbs?

                        And I was actually doing it through the script management, and trying to get it to work that way, then figured I'd just add the working script call to the pre-boot section. But I've added the values to the OSD, and my poor test machine is being re-imaged again, we'll see what happens.


                        Now I just need to figure out why Sophos isn't installing, when LANDesk is getting a successful return, and why a couple certain shortcuts are failing. So much troubleshooting to do, and so little knowledge base to work off of haha

                        • 9. Re: Scripting slmgr.vbs?

                          I still can't get it to work =/ It isn't work for microsoft office either.