I've got the following code for specific needs to build a cookie:
<Identifying the User Logged on to a Remote Computer>
strComputer = "RemoteComputer"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next
<Retrieving the Active Directory Groups a User Belongs To>
On Error Resume Next
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
Set objUser = GetObject _
("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com"
intPrimaryGroupID = objUser.Get("primaryGroupID"
arrMemberOf = objUser.GetEx("memberOf"
If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
WScript.Echo "The memberOf attribute is not set."
Else
WScript.Echo "Member of: "
For each Group in arrMemberOf
WScript.Echo Group
Next
End If
Set objConnection = CreateObject("ADODB.Connection"
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=NA,dc=fabrikam,dc=com>;(objectCategory=Group);" & _
"distinguishedName,primaryGroupToken;subtree"
Set objRecordSet = objCommand.Execute
While Not objRecordset.EOF
If objRecordset.Fields("primaryGroupToken"
= intPrimaryGroupID Then
WScript.Echo "Primary group:"
WScript.Echo objRecordset.Fields("distinguishedName"
& _
" (primaryGroupID: " & intPrimaryGroupID & "
"
End If
objRecordset.MoveNext
Wend
objConnection.Close
How do I take these two scripts and write an ASP page that generates a cookie with that information?
Digatle
<Identifying the User Logged on to a Remote Computer>
strComputer = "RemoteComputer"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next
<Retrieving the Active Directory Groups a User Belongs To>
On Error Resume Next
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
Set objUser = GetObject _
("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com"
intPrimaryGroupID = objUser.Get("primaryGroupID"
arrMemberOf = objUser.GetEx("memberOf"
If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
WScript.Echo "The memberOf attribute is not set."
Else
WScript.Echo "Member of: "
For each Group in arrMemberOf
WScript.Echo Group
Next
End If
Set objConnection = CreateObject("ADODB.Connection"
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=NA,dc=fabrikam,dc=com>;(objectCategory=Group);" & _
"distinguishedName,primaryGroupToken;subtree"
Set objRecordSet = objCommand.Execute
While Not objRecordset.EOF
If objRecordset.Fields("primaryGroupToken"
WScript.Echo "Primary group:"
WScript.Echo objRecordset.Fields("distinguishedName"
" (primaryGroupID: " & intPrimaryGroupID & "
End If
objRecordset.MoveNext
Wend
objConnection.Close
How do I take these two scripts and write an ASP page that generates a cookie with that information?
Digatle