I did find what she was looking for. Here's the code I used.
First the standard header implementing the synthetic include (derived from Rube Goldberg Memorial Scripting Page)
StandardLibrary.vbs is getting big. 1500+ lines of code.
Next a little function for a right fill. Having needed this only once, I haven't included it in the StandardLibrary.
Now the main body of the script.
1. Check commandline to see if a username is specified.
1.1 If nothing specified, throw a fit.
2. Get an array of all the computers currently online.
2.1 No error checking here but there ought to be
3. Tell everyone what's going on.
4. Loop through the names of the online machines
4.1 Trim off the leading \\ put on by NET VIEW
4.2 Write out the name, right filled with dots
4.3 Get an array of the login profiles for the computer
4.4 Scan the array to see if contains the the username (case insensitive search)
4.4.1 If found say so with a CRLF
4.4.2 otherwise issue a CR
The calls to BeginsWith are commented out. They apply only to my situation where a company edict ensures that all desktop pc names start with PC and all laptops with LP.
The supporting library rountines are below, First GetOnLineComputers with its supporting routines, GetNetView, CaptureDOS and ReadFile
Next, BeginsWith (included for completeness sake)
Then GetLoginProfiles, plus support routine AAdd
And, finally, StrInArray.
Unfortunately, this does not run quickly. It can take ages to get through the entire list and sometimes hangs inexplicably. Your mileage may vary.
If anyone comes up with a faster way of doing this I'd be very interested.
No comments:
Post a Comment