update_description.vbs
Set objExplorer = WScript.CreateObject("InternetExplorer.Application", "IE_")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Set objDocument = objExplorer.Document
objDocument.Open
strComputer = "PDC"
strUsername = "testuser"
strPraefix = ""
Set Computer = GetObject("WinNT://"&strComputer&",computer")
Computer.Filter = Array("user")
For Each UserObject in Computer
If UCASE(UserObject.name) = UCASE(strUsername) Then
objDocument.Writeln "<b> " & UserObject.name & "</b> # " & UserObject.fullname & " # " & UserObject.description & "<br />"
strDESC = UserObject.description
UserObject.Put "description" , strPraefix & strDESC
UserObject.SetInfo
End If
Next
Sub IE_onQuit()
Wscript.Quit
End Sub
disable_user.vbs
Set objExplorer = WScript.CreateObject("InternetExplorer.Application", "IE_")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Set objDocument = objExplorer.Document
objDocument.Open
strComputer = "DOMAIN"
strUsername = "USERNAME"
strPraefix = "DEL "
Set Computer = GetObject("WinNT://"&strComputer&",computer")
Computer.Filter = Array("user")
For Each UObj in Computer
If UCASE(UObj.name) = UCASE(strUsername) Then
objDocument.Writeln "<b>" & UObj.name & "</b> # " & UObj.fullname & " # " & UObj.description & "<br />"
objDocument.Writeln " # Expire: " & UObj.AccountExpirationDate & " # LoginScript: " & UObj.LoginScript & "<br />"
objDocument.Write " # Status: "
If UOBj.AccountDisabled = True Then
objDocument.Writeln "Disabled"
Else
objDocument.Writeln "Enabled"
End If
strDESC = UObj.description
UObj.Put "Description" , strPraefix & strDESC
'UObj.SetPassword "neuesKennwort"
UObj.AccountDisabled = True
UObj.SetInfo
End If
Next
Sub IE_onQuit()
Wscript.Quit
End Sub