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)
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
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
No problem. Thanks for the grade.
Regards,
Rob.
Regards,
Rob.
ASKER
Made a couple changes for my situation and it worked like a charm!
Thank you!
Chad