Solved

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

Posted on 2007-03-27
3
237 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Installing Git and chefdk via bat script 8 78
SQL Server Communications Audit 5 92
Control Number of Log Files -Perl 7 74
Vpn Server 2012 not working Draytek Vigor 2830 2 46
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 …
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

803 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