Windows 2003 to set Password in Domain Security Policy
From: IC (IC_at_discussions.microsoft.com)
Date: 03/01/05
- Next message: htv: "login Window from web..."
- Previous message: Al Dunbar [MS-MVP]: "Re: "Microsoft Scripting GUYS"???"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Feb 2005 22:17:01 -0800
I had written a script where it set the Local Security Policy for Password
retention in Windows XP. I am having trouble trying to change the script to
function in Windows Server 2003 Active Directory Domain Security Policy.
Below is my script and I need help. Can someone assist me on how to modify my
script to work in Windows Server 2003? I need to update the Domain Security
Policy and not Domain Controller Security Policy.
Thank you in advance,
IC
'update the local policy
'Minimum Password Age = 0
'Maximum Password Age = 30
'Minimum Password Length = 10
<JOB>
<SCRIPT language="VBScript.Encode">
'**Start Encode**
Set wshShell = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
temp = fs.GetSpecialFolder(0) & "\temp"
Dim INFFilename
INFFilename = temp & "\passwd30_10.inf"
WriteInfFile
If getos = true Then
ConfigurePolicyXP
Else
ConfigurePolicyW2k
End If
Function getos
set OSSet =
GetObject("winmgmts:{impersonationLevel=impersonate}!//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem")
For each OS in OSSet
strOS = OS.Caption
Next
If InStr(stros,"XP") > 0 Then
getos = true
Else
getos = false
End If
End Function
Sub WriteInfFile
Set output = fs.CreateTextFile(INFFilename, True)
output.writeline("[Unicode]")
output.writeline("Unicode=yes")
output.writeline("[Version]")
output.writeline("signature=""$CHICAGO$""")
output.writeline("Revision=1")
output.writeline("[Profile Description]")
output.writeline("Description=Password Policy change / Maximum password
age 30 / Minimum password length 10")
output.writeline("[System Access]")
output.writeline("MinimumPasswordAge = 0")
output.writeline("MaximumPasswordAge = 30")
output.writeline("MinimumPasswordLength = 10")
output.writeline("[Registry Values]")
output.close
End Sub
Sub ConfigurePolicyXP
Command = fs.GetSpecialFolder(1) & "\secedit /db " & temp & "\inport.db
/configure /cfg " & temp & "\passwd30_10.inf /overwrite /quiet "
result = wshshell.Run(Command,0,false)
End Sub
Sub ConfigurePolicyW2k
Command = fs.GetSpecialFolder(1) & "\secedit /db " & temp & "\inport.db
/configure /cfg " & temp & "\passwd30_10.inf /overwrite /quiet "
result = wshshell.Run("cmd",2,false)
wscript.sleep 500
wshshell.sendkeys Command
wscript.sleep 500
wshshell.sendkeys "{ENTER}"
wscript.sleep 2000
wshshell.sendkeys "y {ENTER}"
wscript.sleep 500
wshshell.sendkeys "exit {ENTER}"
End Sub
</SCRIPT>
</JOB>
- Next message: htv: "login Window from web..."
- Previous message: Al Dunbar [MS-MVP]: "Re: "Microsoft Scripting GUYS"???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|