Professional Documents
Culture Documents
status on file
"Beginning the process at " & Now
"Working on the process at " & Now
"Logging completed at " & Now
objOU.SetInfo
'display confirmation that an ou was created and the name of that ou
WScript.Echo("OU " & oOUname & " was created")
'Loop that counts each computer in a network.
For Each Computer In Network
'outputs the computer name on the screen
WScript.Echo(Network(1))
'Counter function that adds 0+1 for each computer in the network
i = i+1
'Repeat
Next
'As long as the resgistry key is available, a version number will be acquired
For Each OSversion In RegOSversion
'OSversion will be equal to RegOSversion
OSversion = objShell.RegRead(RegOSversion)
'output the information contained in the registry key
WScript.Echo "The current version of the Operating System is " & OSversi
on
'tell the program to output error if the registry key is not found
If OSversion > 0 Then
WScript.Echo "Error"
'repeat
Next
'loop that displays information for each individual object (IndItems) within in
the multiple objects (MultiItems) location as defined by the WMI query command
For Each IndItem in MultiItems
WScript.Echo "ActivationRequired: " & IndItem.ActivationRequired
WScript.Echo "IsNotificationOn: " & IndItem.IsNotificationOn
WScript.Echo "ProductID: " & IndItem.ProductId
WScript.Echo "RemainingEvaluationPeriod: " & _
IndItem.RemainingEvaluationPeriod
WsCript.Echo "RemainingGracePeriod: " & IndItem.RemainingGracePeriod
WsCript.Echo "ServerName: " & IndItem.ServerName
Next
'the domain and scope
Query = "<WinNT://dc=trirose,dc=com>;;name;subtree"
'Creates a connection object
Set Connection = CreateObject("ADODB.Connection")
'Command object that shuttles the query to active directory
Set Command = CreateObject("ADODB.Command")
'open the connection
Connection.Open "Provider=ADsDSOObject;"
'use Connection as the active Connection
Command.ActiveConnection = Connection
WScript.Echo("made it to School")
wshNet.MapNetworkDrove "s:", "\\trirose\School\"
wshNet.AddWindowsPrinterConnection _
"\\trirose\SchoolPrinter"
wshNet.SetDefaultPrinter "\\trirose\SchoolPrinter"
End Sub
Sub WorkSub
WScript.Echo("made it to work")
wshNet.MapNetworkDrove "w:", "\\trirose\Work\"
wshNet.AddWindowsPrinterConnection _
"\\trirose\WorkPrinter"
wshNet.SetDefaultPrinter "\\trirose\WorkPrinter"
End Sub
Sub RecreationSub
WScript.Echo("made it to recreation")
wshNet.MapNetworkDrove "r:", "\\trirose\Recreation\"
wshNet.AddWindowsPrinterConnection _
"\\trirose\RecreationPrinter"
wshNet.SetDefaultPrinter "\\trirose\RecreationPrinter"
End Sub
'display when the script starts
Wscript.Echo("beginning " & Now)
'create an instance of the AshShell clas
Set Shell = CreateObject("WScript.Shell")
'use the reg.exe save command, specify the registry key to save and the file to
'save it into
Shell.Exec "%comspec% /k reg.exe export hklm C:\HKLM.REG"
'display when the script completed
WScript.Echo("Completed " & Now)
Computer = "."
Namespace = "\trirose\Printers"
Query = "Select * from WinNT_Printer"
Set WMIService = GetObject("WinNT:\\" _
& Computer & Namespace
Set colItems = WMIService.ExecQuery(Query)
For Each objItem in colItems
WScript.Echo "Name: " & objItem.Name
WScript.Echo "Location: " & objItem.Location
WScript.Echo "Printer Status: " & strStatus
WScript.Echo "Server Name: " & objItem.ServerName
WScript.Echo "Share Name: " & objItem.ShareName
WScript.Echo
Next
Sub subEvalStatus
Select Case objItem.PrinterStatus
Case 1
strStatus = "Other"
Case 2
strStatus = "Unknown"
Case 3
strStatus = "Idle"
Case 4
strStatus = "Printing"
Case 5
strStatus = "Warmup"
Case 6
strStatus = "Stopped Printing"
Case 7
strStatus = "Offline"
Case 8
strStatus = "Out of Ink"
Case 9
strStatus = "Out of Paper"
Case 10
strStatus = "Error"
End Select
End Sub