Answer #1 hit the nail on the head.
Threw in a
strNumber = RTrim(strNumber)
and the problem I cound't see vanished into thin air like a bunch of spaces.....
Now that the logic is working, it's time to do the work.
Thanks again.
The overall goal of this script is to hit all the servers, and if the description field does not contain the S/N, then it will put it there. BUT if it sees it is already there anywhere, it is to skip on to the next server. For starters I'm just gathering info & echoing to test the logic. Then...
Excellent. Plagiarism RULES!
All I had to add was the 'if membercount=0' loop, and replace the left & right quotes with regular quotes.
strNamingContext = "defaultNamingContext"
strConnectionString = "Provider=ADsDSOObject"
strFilter= "ObjectCategory='group'"
'[Functions]...
I need to dump the names of all groups in my AD that have no members into a TXT file. I have looked for a few days now, certain that somebody had already done this, but no joy on the plagurism attempt. Close, but not what I'm looking for. Here's something close:
On Error Resume Next
Const...
The "TerminalServicesProfilePath" property has only ever been accessible via VBS running on a Windows 2003 server, as far as I know. Is this true?
I never saw it as a problem, until I got my new vista machine. I thought it would be a 'from here forward' it will work kind of thing, but Vista's...
Thanks Tsuji, you've saved me again.
I had no idea, and certainly can't find documentation to support it, but you are correct, no user gets made (or not) until the samaccount is populated and commited. Here's what is working for me now:
err.clear
Set objUser = objOU.Create("User", "cn=" &...
OK, I've answered my own question.
Limited testing indicates 'objUser = nothing' is possibly what happens when the user does not get made, as opposed to 'objUser is Nothing', which apparently isn't true in VBSCRIPT even though reality works that way.
So this code now seems to function as...
Try:
wscript.sleep 120
set objWSHShell = WScript.CreateObject("WScript.Shell")
objWSHShell.Run "shutdown.exe /r /m \\" & strcomputer
where strComputer is your netbios name.
This is the syntax for rebooting a remote machine - you may need different 'shutdown.exe' syntax to run local - not sure.
OK, I've tried
err.clear
Set objUser = objOU.Create("User", "cn=" & Common & "")
If objUser Is Nothing Then
objFileRpt.writeline "Error creating " & Common
Else
Still get no error messages when the create fails, it goes ahead to the 'else' part of the statement.
Also tried...
Here's a thought. Scan your AD recursive for all OU's LDAP names. NumStart = instr(txtofOUname,"OU=Users").
If numstart has a value, you've hit one of your target OUs.
If numstart <> 0 then use the Mid function, SomeNum=mid(txtofOUname,numstart + 10,3).
Now you have your #, make your...
Also, the way it's written, you wouldn't know which statement was causing the issue, objfso.FileExists or reftpgetsccss.Test( strsfxcllog ) = True. A false from either of these would result in the identical "Error: Download failed!" messages.
Oh, and Tsuji is correct, the code won't even run...
OK,this should be simple, but it seems not to work.
err.clear
Set objUser = objOU.Create("User", "cn=" & strCommon & "")
If err.number = 0 then
I'd hoped err.number would be 0 if the user created without issue, or some other number if the create failed for whatever reason (duplicate, illegal...
I have what ought to be a pretty simple trap. It either worked (0), or didn't (any non-zero).
But I'm seeing users on my incoming list with invalid names (smith, Jr.) that should and do fail to create. But when they fail to create, they also fail to set err.number at something else than 0...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.