Solved

Activating Windows 2003-2012 remotely with script

Posted on 2013-10-22
5
365 Views
Last Modified: 2013-10-30
I need good examples of activating Windows 2003 up til 2012 remotely by script execution.
0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
Alexios earned 500 total points
ID: 39593361
0
 
LVL 2

Author Comment

by:itnifl
ID: 39596476
That looks like a good solution, however RPC calls that are used here need dns or netbios resolution, which is not possible in my scenario. The same thing goes for slmgr.vbs remote.
0
 
LVL 2

Assisted Solution

by:itnifl
itnifl earned 0 total points
ID: 39602235
Since RPC calls where not working, we ended up with the following code in a script in the template for any new VM. It was automatically executed from a scheduled task as soon as the VM booted. When the script finds ban internet connection, it activates the VM and deletes the scheduled task that runs the script.

Option Explicit
'On Error Resume Next
Dim objShell, objExec, strPingResults, boolExitFlag

boolExitFlag = False
Set objShell = CreateObject("WScript.Shell")

Function ExecPing(strTarget)
	Set objExec = objShell.Exec("ping -n 2 -w 1000 " & strTarget)
	strPingResults = LCase(objExec.StdOut.ReadAll)
	If InStr(strPingResults, "reply from") Then 
		WScript.Echo VbCrLf & strTarget & " responded to ping."
		objShell.Run "slmgr.vbs /ato"
		objShell.Run "schtasks /delete /tn ""Activate_Me"" /F"
		ExecPing = True
	Else
		WScript.Echo VbCrLf & strTarget & " did not respond to ping."
		ExecPing = False
	End If
End Function

Do
	boolExitFlag = ExecPing("www.google.no")
Loop while boolExitFlag <> True

Open in new window

0
 
LVL 13

Expert Comment

by:Alexios
ID: 39608026
Glad to help
0
 
LVL 2

Author Closing Comment

by:itnifl
ID: 39611066
Thanks for participating!
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
What to do when Windows Update is not working correctly? What tools can I use to detect the cause of the malfunction problem? What does this numeric error code mean? These and other questions that you have been asking in the past are answered here (…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question