Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by Jerz

  1. Jerz

    InStr not finding stuff that I can see is in there...

    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.
  2. Jerz

    InStr not finding stuff that I can see is in there...

    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...
  3. Jerz

    Need help with ADSI (I think) syntax for groups with no members

    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]...
  4. Jerz

    Need help with ADSI (I think) syntax for groups with no members

    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...
  5. Jerz

    TerminalServicesProfilePath

    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...
  6. Jerz

    Having trouble with error trap

    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=" &...
  7. Jerz

    Having trouble with error trap

    OK, my posted answer is wrong. 'objUser = nothing' is always true, so this doesn't work either. Any one have any other ideas?
  8. Jerz

    Having trouble with error trap

    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...
  9. Jerz

    VBscript to rename pc, join domain and add pc to ou

    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.
  10. Jerz

    Having trouble with error trap

    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...
  11. Jerz

    vb script to create security groups in nested ous

    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...
  12. Jerz

    Trouble with FileExists method

    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...
  13. Jerz

    Trouble with FileExists method

    wscript.echo strsfxcllogsrc right before you use it. Look carefully at what you are asking the script to find.
  14. Jerz

    Having trouble with error trap

    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...
  15. Jerz

    Broken Trap

    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...

Part and Inventory Search

Back
Top