Solved

Activating Windows 2003-2012 remotely with script

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
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…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

738 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