Solved

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

Posted on 2007-03-27
3
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 71

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 71

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 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