Mit dem ASP Script lassen sich sowohl Anzahl (wie auch Details) zu allen gewünschten Computer Systeme in einer Microsoft Active Directory übersichtlich auf einer ASP Classic Seite darstellen.
Das Script muss auf einen entsprechenden IIS hochgeladen werden. Über die Arrays sowie die Queries lassen sich die Felder die angezeigt werden sollen steuern und filtern. In dem Beispiel wird eine Zusammenfassung der Anzahl aller aktiven Systeme in Active Directory nach Build Nummer gezeigt. Basierend auf den entsprechenden OU`s lassen sich weitere Filter realisieren. Die Hyperlinks verweisen auf eine zweite Seite welche dann die Details zum ausgewählten Hyperlink anzeigt.
<!--
'--###################################################################
'--#Script Name : ad_query.asp
'--#Description : ASP Classic script to gather OS Information of computer
'--# systems out of Microsoft Active directory
'--#Args :
'--#Date : 03. January 2020
'--#Author : Heiko Zschenderlein
'--#Email : Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!
'--#Comments : Development State, to be improved
'--#Disclaimer : Please read the Disclaimer at the end of the script
'--# : Bitte lesen Sie den Haftungsausschluss am Ende des Scripts
'--###################################################################
-->
<%@ Language=VBScript %>
<% response.Buffer = True %>
<font face="arial" size="-1">
<html><head>
<title>Domain enabled Device Details based on OS Level and Hostnames</title>
</head>
<body>
<h1>Domain enabled Device Details based on OS Level and Hostnames</h1>
<%
DeviceOU = "LDAP://DC=DOMAIN,DC=EXAMPLE,DC=COM"
base_query = "Select Name, description, operatingSystem, operatingSystemVersion from '"& DeviceOU &"' Where objectClass='computer' AND UserAccountControl=4096 "
response.write(Date)
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.provider ="ADsDSOObject"
objCon.Properties("User ID") = "DOMAIN\USERNAME"
objCon.Properties("Password") = "PassW00rd"
objCon.Properties("Encrypt Password") = TRUE
objCon.open "Active Directory Provider"
Set objCom = CreateObject("ADODB.Command")
Set objCom.ActiveConnection = objCon
Dim arrSites(1,12) ' erstes Paar, ANzahl Sites
Dim arrOS(2,11) ' OS Name & OS Version
'arrSites(col,row)
arrSites(0,0) = "Location" ' location
arrSites(1,0) = " " ' location code
arrSites(0,1) = "Berlin"
arrSites(1,1) = "AND Name = 'DEBER*'"
arrSites(0,2) = "Stuttgard"
arrSites(1,2) = "AND NAME = 'DESTUT*'"
arrSites(0,3) = "Muenchen"
arrSites(1,3) = "AND NAME = 'DEMUEN*'"
arrSites(0,4) = "..."
arrSites(1,4) = "AND NAME = '...*'"
'-->> ... arrSites(1,12)
arrOS(0,0) = "Windows 7"
arrOS(1,0) = "AND operatingSystemVersion ='*7601*' AND operatingSystem = 'Windows 7*' "
arrOS(2,0) = "10/31/2016"
arrOS(0,1) = "Windows 10 1703"
arrOS(1,1) = "AND operatingSystemVersion ='*15063*'"
arrOS(2,1) = "10/08/2019"
arrOS(0,2) = "Windows 10 1803"
arrOS(1,2) = "AND operatingSystemVersion ='*17134*'"
arrOS(2,2) = "11/10/2020"
arrOS(0,3) = "Windows 10 1809"
arrOS(1,3) = "AND operatingSystemVersion ='*17763*'"
arrOS(2,3) = "05/11/2021"
arrOS(0,4) = "Windows 10 1903"
arrOS(1,4) = "AND operatingSystemVersion ='*18362*'"
arrOS(2,4) = "12/08/2020"
arrOS(0,5) = "Windows 10 1909"
arrOS(1,5) = "AND operatingSystemVersion ='*18363*'"
arrOS(2,5) = "05/10/2022"
arrOS(0,6) = "Server 2003"
arrOS(1,6) = "AND operatingSystem = '*Server 2003*' "
arrOS(2,6) = "07/14/2015"
arrOS(0,7) = "Server 2008"
arrOS(1,7) = "AND operatingSystem = '*Server 2008*' "
arrOS(0,8) = "Server 2012"
arrOS(1,8) = "AND operatingSystem = '*Server 2012*' "
arrOS(2,8) = "10/10/2023"
arrOS(0,9) = "Server 2016"
arrOS(1,9) = "AND operatingSystem = '*Server 2016*' "
arrOS(2,9) = "01/12/2027"
arrOS(0,10) = "Server 2019"
arrOS(1,10) = "AND operatingSystem = '*Server 2019*' "
arrOS(2,10) = "01/09/2029"
'arrOS(0,9) = "Virtual Machines"
'arrOS(1,9) = "AND NAME = '*VM*'"
Response.Write("<table cellspacing='2' cellpadding='2' width=100% valign='top' border='2' >" + vbCrLf)
Response.Write("<TR><TD><b>Location</b></TD> ")
For b = 0 to UBound(arrOS, 2)
Response.Write("<TD align='center'><b>" & arrOS(0,b) & "</b></TD>")
Next
Response.Write("</TR>")
For i = 0 to UBound(arrSites, 2)
Response.Write("<TR><TD><b><i>" & arrSites(0,i) & "</i></b></TD>")
For a = 0 to 10
Set objRS = Nothing
objCom.CommandText = base_query & arrOS(1,a) & arrSites(1,i)
Set objRS = objCom.Execute
result_count = objRS.recordCount
if result_count > 0 then
Response.Write("<td align='center'><a href="/"")
Response.Write("ad_details.asp")
Response.Write("?QueryC=" & Server.URLEncode(objCom.CommandText & " ORDER by Name"))
Response.Write("""<TD align='center'>" & cstr(objRS.recordCount))
else
Response.Write("<TD align='center'>" & cstr(objRS.recordCount))
end if
objRS.Close
next
Next
Response.Write("</TR>")
Response.Write("</TABLE>")
objCon.Close
Set objRS = Nothing
Set objCon = Nothing
Set objCom = Nothing
%>
<!--
'--# DISCLAIMER :
'--# Downloading and using data from this website occurs at the own risk of the User. The Provider does not accept any liability for damages that occur directly or indirectly through the use of provided data.
'--# All logos, trademarks and word marks used, even if not expressly marked as such, are the property of their respective owners.
'--# Das Herunterladen und Verwenden von Daten von dieser Website erfolgt auf eigenes Risiko des Benutzers. Der Anbieter übernimmt keine Haftung für Schäden, die direkt oder indirekt durch die Verwendung der bereitgestellten Daten entstehen.
'--# Alle verwendeten Logos, Markenzeichen und Wortmarken sind, auch wenn nicht ausdrücklich als solche gekennzeichnet, Eigentum ihrer jeweiligen Inhaber.
-->