/build/static/layout/Breadcrumb_cap_w.png

Set local account password not to expire

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?


0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: dugullett 11 years ago
Red Belt
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?


Comments:
  • 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. - billythekid45 11 years ago
    • 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? - dugullett 11 years ago
  • 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' - billythekid45 11 years ago
  • 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: - billythekid45 11 years ago
    • 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. - dugullett 11 years ago
      • 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' - billythekid45 11 years ago
  • 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 - billythekid45 11 years ago
  • I want to keep the "techs" local system account from expiring and the code in the VBscript did not accoplish this. - billythekid45 11 years ago
  • 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. - billythekid45 11 years ago
  • 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. - dugullett 11 years ago
  • I changed the script to be an "Online script" but it still didn't execute properly. Any other suggestions? - billythekid45 11 years ago
    • and you changed to "logged in user"? - dugullett 11 years ago
      • 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. - dugullett 11 years ago
Posted by: billythekid45 11 years ago
Senior Yellow Belt
1

I have also tried....

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


Comments:
  • 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. - billythekid45 11 years ago
  • Did you upload wscript? - dugullett 11 years ago
  • I tried that too but it just opened wscript when it executed instead of passing the file to wscript. - billythekid45 11 years ago
  • Have you seen this http://www.itninja.com/question/kace-k1000-how-do-you-run-a-vbscript-file - dugullett 11 years ago
    • You might want to also tag "K1000 appliance". You'll get more answers. - dugullett 11 years ago
Posted by: SMal.tmcc 11 years ago
Red Belt
1

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


Comments:
  • 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 - dugullett 11 years ago
    • thanks for the addition - SMal.tmcc 11 years ago
  • SMal.tmcc- Should I run this from a command window? - billythekid45 11 years ago
    • That's powershell. Judging from your log file you are using XP. So this is probably not the best option. - dugullett 11 years ago
      • 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. - SMal.tmcc 11 years ago
  • Nice catch, assumed Win 7 - SMal.tmcc 11 years ago
  • I believe xp was
    NET ACCOUNTS /MAXPWAGE:UNLIMITED - SMal.tmcc 11 years ago
  • This is for WinXP and Win7. - billythekid45 11 years ago
  • Then follow the advice from dugullett, he has helped me a lot with scripts and will get it figured out for you. - SMal.tmcc 11 years ago
  • dugullett is a great help - brighstarcuit 11 years ago
  • 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. - SMal.tmcc 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ