Hi guys,

I need a script to run on the kbox that gives the same result as...

wscript Drive:\PathToFile\expire.vbs username

but runs from the Kbox. I've already shared the file from my PC and made a .bat file to run the command from the kbox. The only issue is when the script tries to run on 700 PCs most the PCs get the error message that "no more connections to this PC can be made b/c there are already as many connections as the computer can accept.

Any suggestions?

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

Just so I'm clear.... You have a vbs that sets the password to never expire?

You are using a bat file to run the vbs?

Can you describe how you are doing this? I'm assuming a KScript.

Do you get this error message only on this one script?

Is group policy an option?

Answered 07/24/2012 by: dugullett
Red Belt

  • Dugullett- I do have a vbs that sets the pwd to never expire. I am trying to run this via a Kscript. I have other working scripts but they do not call wscript and they are not vbs scripts. Group policy is not an option for me.
    • Can you post a screenshot of the KScript that you are running? Specifically the steps and the dependencies.

      Also post your script. Does the script work when you run it from the local machine?
  • Here is the error I get, code to follow.

    Log for 1st Local Techs acct does not expire on MIS-PC22[ Show All ]

    --------------------------------------------------------------------------------

    Started: 2012/07/24 16:27:48
    Finished: 2012/07/24 16:27:50
    Elapsed Time: 2 second
    Status: 2


    Output Log
    Running as: SYSTEM
    Error creating process: C:\WINDOWS\System32\cscript "C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\expire.vbs techs": (1) Incorrect function.
    Activity Log
    Launching program: 'C:\WINDOWS\System32\cscript' '"C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\expire.vbs techs"' wait='true'
  • Here is what I am trying to run...

    Attempts:
    On Failure: Break Continue

    Verify
    Launch “SYS\cscript†with params “â€$(KACE_DEPENDENCY_DIR)\expire.vbs techs“â€.

    Directory:
    File:
    Wait for startup
    Parameters:
    • Try this:

      Launch a program:
      Directory: $(KACE_SYS_DIR)

      File: cscript.exe

      Parameters: $(KACE_DEPENDENCY_DIR)\expire.vbs techs

      Maybe this is what you did do, but it looks like it might have been cut off.
      • When I run it as shown above I get error msg...

        Output Log
        Running as: SYSTEM
        Error creating process: C:\WINDOWS\System32\cscript.exe "C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\expire.vbs techs": (1) Incorrect function.
        Activity Log
        Launching program: 'C:\WINDOWS\System32\cscript.exe' '"C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\expire.vbs techs"' wait='true'
  • Here is expire.vbs

    'Pass in the name of the local user account as an argument
    Dim ArgObj, userAccount
    Set ArgObj = WScript.Arguments

    userAccount = ArgObj(0)
    strComputer = "."
    strUser = userAccount
    Set User = Getobject("WinNT://" & strComputer & "/" & strUser)

    'Password never expires flag
    Flags = User.Get("UserFlags")
    User.put "Userflags", flags OR &H10000
    user.setinfo

    'User cannot change password flag
    'Not needed so I commented it out
    'Flags = User.Get("UserFlags")
    'User.put "Userflags", flags OR &H0040
    'user.setinfo

    Set User = nothing
  • I want to keep the "techs" local system account from expiring and the code in the VBscript did not accoplish this.
  • If I run... wscript Drive:\PathToFile\expire.vbs username it works, on a local machine but I am having trouble making a kbox script with it.
  • Change this to an "Online Script" if not already, and run as "user logged in". Make sure that user is an admin. I'm wondering if running it as SYSTEM is causing issues.
  • I changed the script to be an "Online script" but it still didn't execute properly. Any other suggestions?
    • and you changed to "logged in user"?
      • You could also try instead of launching a program, running a bat. Use the same command line you use to call your script when running on your local machine.

        C:\WINDOWS\system32\cscript.exe expire.vbs username

        I'm thinking it's something to do with the argument you have in the script. Maybe see if you can embed the username into the script instead of doing it the way you are currently.
Please log in to comment

Answers

1

I have also tried....

Launch $(KACE_DEPENDENCY_DIR)\expire.vbs with params acct

Answered 07/24/2012 by: billythekid45
Senior Yellow Belt

  • The error msg is...
    Running as: SYSTEM
    Error creating process: C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\wscript.exe C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\304\expire.vbs acct: (2) The system cannot find the file specified.
  • Did you upload wscript?
  • I tried that too but it just opened wscript when it executed instead of passing the file to wscript.
  • Have you seen this http://www.itninja.com/question/kace-k1000-how-do-you-run-a-vbscript-file
    • You might want to also tag "K1000 appliance". You'll get more answers.
Please log in to comment
1

wmic path Win32_UserAccount where Name='username' set PasswordExpires=false

Answered 07/24/2012 by: SMal.tmcc
Red Belt

  • If you're going to use this make sure to add [Environment]::UserName. This way you do not have to populate every username.

    $user= [Environment]::UserName
    wmic path Win32_UserAccount where Name="$user" set PasswordExpires=false
  • SMal.tmcc- Should I run this from a command window?
    • That's powershell. Judging from your log file you are using XP. So this is probably not the best option.
      • Test to see if if you have WMIC on your machine. Open a cmd windows and type wmic and see if you get the wmic:root prompt or not.
  • Nice catch, assumed Win 7
  • I believe xp was
    NET ACCOUNTS /MAXPWAGE:UNLIMITED
  • This is for WinXP and Win7.
  • Then follow the advice from dugullett, he has helped me a lot with scripts and will get it figured out for you.
  • dugullett is a great help
  • This is one of the best forums I have been on in a long time, the one's that are willing to provide help are very skilled in their area's of focus and have great overall knowledge also. this field is a lot like the medical field, you need general knowledge, but there is so much out there you need to pick a specialty. There are a least 3 ways to anything in windows and usually more and the variations of answers allow you to pick what works best for you.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share