Hi all,
First of all, thanks to everyone who has contributed tools, I've found many really useful.
Just thought I would pass on something that I have come across that could be really useful for those who want to have a go at scripting. This can be used to make tools in Hyena.
Microsoft have released a utility called Scriptomatic that automatically writes WMI (Windows Management Instrumentation) scripts.
It can be downloaded here http://tinyurl.com/fk6q
It's really easy to use, even if you haven't done much scripting before - like me!
I won't say too much about it - have ago and you'll soon see just how much info it can produce.
Once you have found some things you want Hyena top report on, you'll want to create a tool to run the script after you select a computer in Hyena.
Below you will find a sample that will get you working. Like I said, I'm new to scripting too and I borrowed part of the script from elsewhere. As a result there may be a few lines that are redundant - but it does work without errors. If you can improve on it then post it back!
I have listed two tools that do the same job, but output differently. The first one outputs to a dos windows and the second one will output to a windows dialog box. Just to show that there are two ways of doing things.
This one outputs to a dos window:
Menu Caption= Cmd Lookup video mode properties
Command line= cmd /c cls & cscript.exe "\\server\share\display.vbs" //I //NoLogo %E% & pause
This one outputs to a windows dialog box:
Menu Caption= Win lookup video mode
Command line= wscript.exe "\\server\share\display.vbs" //I //NoLogo %E%
*Change the \\server\share to the location where you will save the file display.vbs
Copy the text below into a file called Display.vbs
' start of script
' get the arguments
Dim objArgs : Set objArgs = WScript.Arguments ' create object with collection
' determine if an argument was passed
If objArgs.Count >= 1 Then
strComputer = objArgs(0) 'assign the passed computer name to a variable
Else ' prompt for a computer, or the current domain
strComputer = InputBox("Enter the name of the computer where you wish to change to local admin account." & _
vbCrLf & vbCrLf & "Blank out this name and click ""OK"" to do the entire <" & strDomain & "> domain.","Enter computer name",WshNetwork.ComputerName)
If strComputer = "" Then
' ensure the user wants to apply this to the entire domain
strResponse = MsgBox ("I'm sorry, but I need clarification." & vbCrLf & vbCrLf & _
"If you wish to scan the <" & strDomain & "> domain, click 'Yes'" & vbCrLf & vbCrLf & _
"If you wish to quit this scan/script, click 'No'", vbYesNo + vbExclamation + vbDefaultButton2, "Please confirm...")
' ensures the user wanted to quit
If strResponse = vbNo Then
WScript.Quit
End If
End If
End If
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DisplayControllerConfiguration",,48)
For Each objItem in colItems
Wscript.Echo "VideoMode: " & objItem.VideoMode
Next
'end of script
Hope you find this useful.
First of all, thanks to everyone who has contributed tools, I've found many really useful.
Just thought I would pass on something that I have come across that could be really useful for those who want to have a go at scripting. This can be used to make tools in Hyena.
Microsoft have released a utility called Scriptomatic that automatically writes WMI (Windows Management Instrumentation) scripts.
It can be downloaded here http://tinyurl.com/fk6q
It's really easy to use, even if you haven't done much scripting before - like me!
I won't say too much about it - have ago and you'll soon see just how much info it can produce.
Once you have found some things you want Hyena top report on, you'll want to create a tool to run the script after you select a computer in Hyena.
Below you will find a sample that will get you working. Like I said, I'm new to scripting too and I borrowed part of the script from elsewhere. As a result there may be a few lines that are redundant - but it does work without errors. If you can improve on it then post it back!
I have listed two tools that do the same job, but output differently. The first one outputs to a dos windows and the second one will output to a windows dialog box. Just to show that there are two ways of doing things.
This one outputs to a dos window:
Menu Caption= Cmd Lookup video mode properties
Command line= cmd /c cls & cscript.exe "\\server\share\display.vbs" //I //NoLogo %E% & pause
This one outputs to a windows dialog box:
Menu Caption= Win lookup video mode
Command line= wscript.exe "\\server\share\display.vbs" //I //NoLogo %E%
*Change the \\server\share to the location where you will save the file display.vbs
Copy the text below into a file called Display.vbs
' start of script
' get the arguments
Dim objArgs : Set objArgs = WScript.Arguments ' create object with collection
' determine if an argument was passed
If objArgs.Count >= 1 Then
strComputer = objArgs(0) 'assign the passed computer name to a variable
Else ' prompt for a computer, or the current domain
strComputer = InputBox("Enter the name of the computer where you wish to change to local admin account." & _
vbCrLf & vbCrLf & "Blank out this name and click ""OK"" to do the entire <" & strDomain & "> domain.","Enter computer name",WshNetwork.ComputerName)
If strComputer = "" Then
' ensure the user wants to apply this to the entire domain
strResponse = MsgBox ("I'm sorry, but I need clarification." & vbCrLf & vbCrLf & _
"If you wish to scan the <" & strDomain & "> domain, click 'Yes'" & vbCrLf & vbCrLf & _
"If you wish to quit this scan/script, click 'No'", vbYesNo + vbExclamation + vbDefaultButton2, "Please confirm...")
' ensures the user wanted to quit
If strResponse = vbNo Then
WScript.Quit
End If
End If
End If
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DisplayControllerConfiguration",,48)
For Each objItem in colItems
Wscript.Echo "VideoMode: " & objItem.VideoMode
Next
'end of script
Hope you find this useful.
Comment