Question : Export pager field from active directory

Could someone help me in writing a VB script, to export the pager field from active directory and insert it into a registry key?

Answer : Export pager field from active directory

The below code should work.  Change strRegKey and strValueName to suit the location and value name that you want to put the Pager number.

Regards,

Rob.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
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
Random Solutions  
 
programming4us programming4us