Link to home
Start Free TrialLog in
Avatar of TechniMemphis
TechniMemphis

asked on

VBS script to connect via IPC and return "correct" or "failed" password

I need to run a script that will tell me:
1 is the computer on and responding to IPC queries?
2 "is this username/password' I'm using valid?


Why?
I can get serials from computer that are on and I have the password to, the rest fail (of course)
The script I want to write will tell me if I'm looking for a turned off computer or do I need to find the correct password?


BTW: I don't need this really written *for* me, just need the code snippets and/or Google search terms to help me find what I'm missing:
Is this computer responding? (do I need to find its last logon, has it logged in)
Is my password wrong?  (error code and what the heck to do with one)

On Error Resume Next
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate("excel")
 
'file output
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\Documents and Settings\All Users\Desktop\SERIALS.CSV", True)
 
 
Computers = Array("comp1","comp2")
For Each Computer in Computers
winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& Computer &""
'WScript.Echo winmgmt1
Set SNSet = nothing
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
REM	MsgBox "The serial number for the specified computer is: " & Computer & SN.SerialNumber
REM    WshShell.Sendkeys (Computer)
REM    WshShell.Sendkeys ("{tab}")
REM    WshShell.Sendkeys (SN.SerialNumber)
REM    WshShell.Sendkeys ("{ENTER}")
 
' Output
a.Writeline (Computer)&","& (SN.SerialNumber)
Next
Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TechniMemphis
TechniMemphis

ASKER

Absolutely perfect!!
Made a couple changes for my situation and it worked like a charm!
Thank you!
Chad

No problem. Thanks for the grade.

Regards,

Rob.