Solved

Activating Windows 2003-2012 remotely with script

Posted on 2013-10-22
5
357 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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…

770 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