|
Hello together
I have a vbs Script that i want to convert into a kix script. I used the vbs2kix UDF but this doesn't convert all the code into kix. Can someone help me?
The vbs code is the following:
********************************************************************** On Error Resume Next
'set variables Dim objConnection, objCommand, objRootDSE, strDNsndgov, strDNgsvbs Dim strFilter, strQuery, objRecordSet, objArgs Dim objShell, WSHNetwork, strStatus, IE
Dim objUserGSVBS, objUserSND, oldpasswd, newpasswd, userstring Const wshYes = 6 Const wshNo = 7 Const wshYesNoDialog = 4 Const wshQuestionMark = 32
Set objShell = CreateObject("Wscript.Shell") Set WSHShell = WScript.CreateObject("WScript.Shell") Set WSHNetwork = WScript.CreateObject("WScript.Network") 'userstring = WSHNetwork.UserName userstring = "test_cfb"
'Connect to AD Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOOBject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection 'strBase = "<LDAP://rintra.ruag.com>" strBase = "<LDAP://tsb.ruag.com>"
'Set Filter to samAccountName strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & userstring & "))"
'Set Attribute to DN strAttributes = "distinguishedName,sn,GivenName"
'Find DN strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree" objCommand.CommandText = strQuery objCommand.Properties("Page Size") = 99999 objCommand.Properties("Timeout") = 300 objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF strDNsndgov = objRecordSet.Fields("distinguishedName") strDNname = objRecordSet.Fields("sn") strDNvorname = objRecordSet.Fields("GivenName") objRecordSet.MoveNext Loop
'======================================== ' First, get the domain policy. '======================================== Dim oDomain Dim oUser Dim maxPwdAge Dim numDays Dim pass_last_change, pass_expire 'wscript.echo strDNsndgov 'strDomainDN = "RINTRA.RUAG.COM" strDomainDN = "TSB.RUAG.COM" strUserDN = strDomainDN & "/" & strDNsndgov wscript.echo strUserDN Set oDomain = GetObject("LDAP://" & strDomainDN) Set maxPwdAge = oDomain.Get("maxPwdAge")
'======================================== ' Calculate the number of days that are ' held in this value. '======================================== numDays = CCur((maxPwdAge.HighPart * 2 ^ 32) + _ maxPwdAge.LowPart) / CCur(-864000000000) WScript.Echo "Maximum Password Age: " & numDays '======================================== ' Determine the last time that the user ' changed his or her password. '======================================== Set oUser = GetObject("LDAP://" & strUserDN)
'======================================== ' Add the number of days to the last time ' the password was set. '======================================== whenPasswordExpires = DateAdd("d", numDays, oUser.PasswordLastChanged) 'WScript.Echo "Password Last Changed: " & oUser.PasswordLastChanged 'WScript.Echo "Password Expires On: " & whenPasswordExpires pass_last_change = FormatDateTime(oUser.PasswordLastChanged, 2) pass_expire = FormatDateTime(whenPasswordExpires, 2) WScript.Echo "Password Expires On: " & pass_expire datum = DateDiff("d",now,pass_expire) wscript.echo datum If datum < 13 Then WScript.Echo("Password expires in Days: " & DateDiff("d",now,pass_expire)) WScript.Quit(1) Else Wscript.echo "Passwort noch nicht unter 12 Tagen" WScript.Quit(0) End If '======================================== ' Clean up. '======================================== Set oUser = Nothing Set maxPwdAge = Nothing
'Close AD Connection objConnection.Close
'Clear Variables Set objConnection = Nothing Set objCommand = Nothing Set objRootDSE = Nothing Set objRecordSet = Nothing **********************************************************************
Thanks... bye tömu
|