Solved

Re: How to automatically check Password Never Expires for all user in a Local PC

Posted on 2007-03-27
3
238 Views
Last Modified: 2010-04-16
Hi guys,
i got a questions.... is it possible to automatic check the "password never expires" box option for all local user in the local pc using vbscript???
thank guys inadvance =)
0
Comment
Question by:Manfredtoo
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 18802760

But of course :) This should do it.

Const UF_DONT_EXPIRE_PASSWD = &H10000

strComputer = "SomePC"

Set objUsers = GetObject("WinNT://" & strComputer)
objServer.Filter = Array("user")
For Each objUser In objUsers
      intUserFlags = objUser.Get("userFlags")
      If intUserFlags And Not UF_DONT_EXPIRE_PASSWD Then
            objUser.Put "userFlags", intUserFlags XOr UF_DONT_EXPIRE_PASSWD
      End If
Next
0
 

Author Comment

by:Manfredtoo
ID: 18804212
Chris-Dent:hiya it pops up with this Error: Object required: 'objServer'
code: 800A01A8, Source: Microsoft VBscript runtime error. hmm....
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 18806441

Sorry this is a bit late, had to go to bed.

It should have read:

objUsers.Filter = Array("user")

Doing a few too many things at once. I take it you've got it all working?

Chris
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
The viewer will learn how to count occurrences of each item in an array.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question