Solved

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

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Enterprise networks where VoIP phones have been deployed frequently use port configurations that allow both a computer and an IP phone to be plugged into the same switch port but use different VLANs. On Cisco equipment I'm referring to the "native V…
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 …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now