Solved

How to querry server for license information using slmgr.vbs

Posted on 2011-03-04
5
2,616 Views
Last Modified: 2013-11-29
We deployed some 2008 servers in the past with the wrong license and now some of them are losing their activation.   I can use the slmgr.vbs script to capture individual server status but need to find a way to query all my servers. there are probably a couple hundred.

I used the command

cscript slmgr.vbs computername -xpr

output:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

The machine is permanently activated.

How can I use the script to query all my 2008 servers an dump the results to it's own result file?  example: computername.txt

(I have a text file named computers.txt with all of them listed)



0
Comment
Question by:Globalquest
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:devinnoel
ID: 35039998
The standard redirection symbol > might work.

Try adding:
> filename.txt

On the end, it should the output to a file.

C:\Temp>dir *.txt
 Volume in drive C is OSDisk

 Directory of C:\Temp

File Not Found

C:\Temp>echo testing
testing

C:\Temp>dir *.txt
 Volume in drive C is OSDisk

 Directory of C:\Temp

File Not Found

C:\Temp>echo testing > test.txt

C:\Temp>dir *.txt
 Volume in drive C is OSDisk

 Directory of C:\Temp

03/04/2011  02:01 PM                10 test.txt
               1 File(s)             10 bytes

C:\Temp>type test.txt
testing

Open in new window


0
 

Author Comment

by:Globalquest
ID: 35040073
I can run the command

cscript slmgr.vbs computername -xpr >c:\computername.txt

And that will give me the the desired results for that specific computer in that file.

What I really need is a way to scan multiple servers listed in either a text or csv file and dump the results into a text file for each server scanned.

I've tried editing a copy of  slmgr.vbs with no luck.  Of course, I am not a scripter.
0
 
LVL 78

Expert Comment

by:arnold
ID: 35041398
you could use for %host% in contents from a file:
Example: http://www.tech-recipes.com/rx/363/processing-the-contents-of-a-text-file-using-for-loop/
FOR /f %a in (‘complist.txt’) do echo Computer: %a
replace the echo with the line you have and make sure to change the redirect (>) to append using (>>)

Open in new window

0
 

Author Comment

by:Globalquest
ID: 35059208
Ok here is the command that has so far worked

FOR /f %a in (d:\ncs\act\servers.txt) do cscript slmgr.vbs  %a -xpr >d:\ncs\act\%a.txt

It queries the server and dumps to it's own text file.  This is helpful because the output of the vbs script does not echo the server name.
0
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 35059934
there is nothing that prevents you from doing the
(echo %%a >> somefile; cscript slmgr.vbs  %a -xpr >> somefile; echo end of %%a >> somefile)
http://stackoverflow.com/questions/359120/batch-how-to-end-an-for-loop-properly
0

Featured Post

Surfing Is Meant To Be Done Outdoors

Featuring its rugged IP67 compliant exterior and delivering broad, fast, and reliable Wi-Fi coverage, the AP322 is the ideal solution for the outdoors. Manage this AP with either a Firebox as a gateway controller, or with the Wi-Fi Cloud for an expanded set of management features

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Security Pop-Up 7 73
Well known ports and optimal ports scanning range 12 102
Exchange2013 MAPI 6 68
MyDlink DCS930L camera Registration/Account 4 66
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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