Hey,
My boss has asked me to write a simple script, however he has told me i can NOT use a batch file. He has asked me to stop using them, and move onto WSH - Windows Scripting Host.
I have read up on the msdn wbesite, and also anything i have found in google.
The script needs to connect to a remote devices (140 different servers) and query a reg key (find out default printer) and output the server name , followed by the registry key value (HP/Lexmark/ETC)
For a batch file i would do a for loop for a text file containing all of the server names, and use a app i have called reg find which would query reg keys remotely.
This is what i have so far
If i save this as a *.vbs/wsh/wsf it errors. However if i save it as a *.jscript it echo's the key to a msg box.
How would i write this to work with wscript to output to a text file, and loop for all devices in a text file?
Also, can anyone point me in the direction of any good tutorials or samples? Another also, what is it you type in start > run to launch the free vb editor in XP? I can't for the life of me remember.
My boss has asked me to write a simple script, however he has told me i can NOT use a batch file. He has asked me to stop using them, and move onto WSH - Windows Scripting Host.
I have read up on the msdn wbesite, and also anything i have found in google.
The script needs to connect to a remote devices (140 different servers) and query a reg key (find out default printer) and output the server name , followed by the registry key value (HP/Lexmark/ETC)
For a batch file i would do a for loop for a text file containing all of the server names, and use a app i have called reg find which would query reg keys remotely.
This is what i have so far
Code:
//========================================
// Find Default Printer
//========================================
var WshShell = WScript.CreateObject("WScript.Shell");
var bKey = WshShell.RegRead ("HKLM\\Software\\Novell\\Login\\DefaultUserName");
WScript.Echo (bKey);
If i save this as a *.vbs/wsh/wsf it errors. However if i save it as a *.jscript it echo's the key to a msg box.
How would i write this to work with wscript to output to a text file, and loop for all devices in a text file?
Also, can anyone point me in the direction of any good tutorials or samples? Another also, what is it you type in start > run to launch the free vb editor in XP? I can't for the life of me remember.