In my opinion Imail’s Active Directory integration is rudimentary at best. They took the all or nothing approach. The following code is something I wrote to let users logon with their Active Directory account to manage their Distribution Lists. It generates a random password in Imail and then automatically logs them in to the system. The user never knows their Imail password and they think its all connected.
Its also a simple example of HTML form automation with javascript.
Set WshShell = CreateObject( “WScript.Shell” )
‘our imail domain in the registry, this is so we can see if the user exists imailDomain = “your.domain.com” ‘the imail adduser utility. imailAddUser = “C:\Program Files\Ipswitch\IMail\adduser.exe” ‘get the logon username and remove the domain name from it username = replace(request.servervariables(“LOGON_USER”), “NTDomain\”,”",1,1,1) ‘generate a random password password = generatePassword(15) ‘check to see if they have an imail account if AccountExists(username) then ‘change password WshShell.exec imailAddUser & ” -mod -u ” & username & ” -p ” & password ‘write the html frames webpage, We use frames so we can use the onload event. writeframes() else ‘The error message could be better but it does the job. response.write “Your account does not exists” end if ‘*** Functions function AccountExists(username) ‘check to see if the user exists in the imail registry. on error resume next registrykey = WshShell.RegRead( “HKLM\SOFTWARE\Ipswitch\IMail\Domains\” & imailDomain & “\Users\” & username & “\MailAddr”) if err.number <> 0 then AccountExists = false else AccountExists = true end if end function Function generatePassword(passwordLength) ‘some asp function i found on the net to generate a random password. sDefaultChars=”abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789!#${}” iPasswordLength=passwordLength iDefaultCharactersLength = Len(sDefaultChars) Randomize’initialize the random number generator ‘Loop for the number of characters password is to have For iCounter = 1 To iPasswordLength ‘Next pick a number from 1 to length of character set iPickedChar = Int((iDefaultCharactersLength * Rnd) + 1) ‘Next pick a character from the character set using the random number iPickedChar ‘and Mid function sMyPassword = sMyPassword & Mid(sDefaultChars,iPickedChar,1) Next generatePassword = sMyPassword End Function Function rot13(rot13text) ‘some asp function i found on the net to generate a rot13 encrption rot13text_rotated = “” ‘ the function will return this string For i = 1 to Len(rot13text) j = Mid(rot13text, i, 1) ‘ take the next character in the string k = Asc(j) ‘ find out the character code if k >= 97 and k =< 109 then k = k + 13 ‘ a … m inclusive become n … z elseif k >= 110 and k =< 122 then k = k – 13 ‘ n … z inclusive become a … m elseif k >= 65 and k =< 77 then k = k + 13 ‘ A … m inclusive become n … z elseif k >= 78 and k =< 90 then k = k – 13 ‘ N … Z inclusive become A … M end if ‘add the current character to the string returned by the function rot13text_rotated = rot13text_rotated & Chr(k) Next rot13 = rot13text_rotated End Function sub writeFrames() ‘write the html frames and javascript to automate the imail form %> <html> <head> <title> Imail LS Glue </title> <script language=”javascript”> String.prototype.enc = function(){ return this.replace(/[a-zA-Z]/g, function(c){ return String.fromCharCode((c <= “Z” ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c – 26); }); }; function logon() { var s = “<%=rot13(password)%>”; parent.imail.document.form1.txtUserName.value=’<%=username%>’; parent.imail.document.form1.txtPassword.value=s.enc(); parent.imail.document.form1.btnLogin.click(); } </script> </head> <frameset rows=”0%,100%” border=”0″ onLoad=”logon();”> <frame src=”blank.html” name=”manager” noresize> <frame src=”/iadmin/login.aspx” name=”imail” noresize> </frameset> </html> <% end sub
Quick ADMX GPO policy to disable IP6 on your network according to MS KB 929852
IP6_disable.admx
IP6_disable.adml
Note The value "0" is the default setting.
2. Type 0xffffffff to disable all IPv6 components, except the IPv6 loopback interface. This value also configures Windows Vista to use Internet Protocol version 4 (IPv4) instead of IPv6 in prefix policies.
3. Type 0×20 to use IPv4 instead of IPv6 in prefix policies.
4. Type 0×10 to disable native IPv6 interfaces.
5. Type 0×01 to disable all tunnel IPv6 interfaces.
6. Type 0×11 to disable all IPv6 interfaces except for the IPv6 loopback interface.
http://support.microsoft.com/kb/929852
Here is my AdamSync config using the ProxyUser class. It took me a while to get everything going right but it works and after a full sync the incremental syncs take less than 30 seconds.
We do not sync our entire AD partition only a subset. After alot of reading objectCategory is better then objectClass because objectCategory is indexed in AD.
I found this utility oldcmp on the internet that makes it easier to find old computer accounts in active directory.
You have to be careful with this utility so you do not accidentally delete computer accounts that are being used.
Another note, in my testing Macintosh computers do not update their computer password as frequently as PCs do.
This little vbscript wrapper will let you start a logon script hidden. Our logon scripts are batch and perl files and they all start with the black box. If you launch the script like hidelaunch.vbs logon.bat it will start the logon script hidden.
Set wshShell = CreateObject("WScript.Shell")
set args = wscript.arguments
command = ""
for each strArg in args
command = strArg + " "
next
wshshell.run command, 0, false
To parse the UserAccountControl field in Active Directory you have to use a bit-wise and of “&” and not “&&” to check the value. Below are some examples Here is a MSDN page that has more information.
This MS site also has more values listed.
#Check if the account is Disabled $strStatus & 2 #Check if the account is Locked $strStatus & 16
VBscript that reads the users info property in AD for a list of printers to map.
On error resume next
Set WshNetwork = Wscript.CreateObject("Wscript.Network")
set oUser = GetObject("LDAP://CN=" & WshNetwork.username & ",OU=Users,DC=Domain,DC=Local")
Printers=split(oUser.Get("info"),VbCrLf)
first=True
For i = LBound(Printers) to UBound(Printers)
If first = True Then
WshNetwork.AddWindowsPrinterConnection(trim(Printers(i)))
WshNetwork.SetDefaultPrinter(trim(Printers(i)))
first=False
Else
WshNetwork.AddWindowsPrinterConnection(trim(Printers(i)))
End If
Next

Recent Comments