Hey!!
I have this VB Script that works perfect as a VBscript. Now, I want this to be as an webpage so when you go to this page, it runs the script and gives the result (all servers in a specific ou in AD). I guess I have to make an ASP of this, and it's more or less just the "echo":ing that needs to change, but I get wscript error. Please help.
Heres the code
-----------------------------------------------------------
<SCRIPT LANGUAGE="VBScript">
<!--
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://OU=phi,DC=ikea,DC=com' " _
& "where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If inStr(objRecordSet.Fields("Name").Value,"-NT") Then Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
'-->
</SCRIPT>
--------------------------------------------------------
/Daniel
I have this VB Script that works perfect as a VBscript. Now, I want this to be as an webpage so when you go to this page, it runs the script and gives the result (all servers in a specific ou in AD). I guess I have to make an ASP of this, and it's more or less just the "echo":ing that needs to change, but I get wscript error. Please help.
Heres the code
-----------------------------------------------------------
<SCRIPT LANGUAGE="VBScript">
<!--
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://OU=phi,DC=ikea,DC=com' " _
& "where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If inStr(objRecordSet.Fields("Name").Value,"-NT") Then Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
'-->
</SCRIPT>
--------------------------------------------------------
/Daniel