Hey Scripting Guy! I need to convert a VBScript into Windows PowerShell 2.0. The script calls Internet Explorer in kiosk mode, retrieves some information from the Customer (Phone Number, Department) & then updates AD account information using an account that has the relevant rights
The VBScript I have is:
'WScript.Sleep 1000 * 10
sADAdminUser = "domain\username"
sADAdminPass = "password"
On Error Resume Next
Const ADS_NAME_INITTYPE_DOMAIN = 1
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Const ADS_SECURE_AUTHENTICATION = &H1
Set oWShell = CreateObject("Wscript.Shell")
sUserName = oWShell.ExpandEnvironmentStrings("%username%")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
sDomain = Replace(Replace(Lcase(iAdRootDSE.Get("defaultNamingContext")), "dc=", ""), ",", ".")
Set iAdRootDSE = Nothing
Set oNameTranslate = CreateObject("NameTranslate")
oNameTranslate.Init ADS_NAME_INITTYPE_DOMAIN, sDomain
oNameTranslate.Set ADS_NAME_TYPE_NT4, "CORP\" & sUserName
sDN = oNameTranslate.Get(ADS_NAME_TYPE_1779)
If Err.Number = 0 Then
Set oLDAP = GetObject("LDAP:")
Set oUser = oLDAP.OpenDSObject("LDAP://" & sDN, sADAdminUser, sADAdminPass, ADS_SECURE_AUTHENTICATION)
If LCase(oUser.extensionAttribute3) <> "sometext" Then
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.FullScreen = True
objExplorer.StatusBar = 0
objExplorer.Visible = 1
objExplorer.resizable = No
objExplorer.menubar = 0
objExplorer.Navigate "weblink"
oUser.SetInfo
End If
End If
Set oUser = Nothing
Set oLDAP = Nothing
Set oTranslate = Nothing
Set oWShell = Nothing
Please help :)