Set objADSysInfo = CreateObject("ADSystemInfo")
strUser = objADSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strPager = objUser.Pager
strRegKey = "HKCU\Software\MyKey\"
strValueName = "MyPager"
If Right(strRegKey, 1) <> "\" Then strRegKey = strRegKey & "\"
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
objShell.RegWrite strRegKey & strValueName, strPager, "REG_SZ"
If Err.Number = 0 Then
MsgBox "Your Pager has been stored in the registry."
Else
MsgBox "Failed to store your Pager into the registry. Error " & Err.Number & ": " & Err.Description
End If
|