Sign in to follow this  
Followers 0
stevethornton

How can I get the "Computer Desction"

3 posts in this topic

I am trying to get a list of all the computers on my network. I have done the easy bit and got a list of the Computer Names, but have not been able to get the associated Computer Descriptions. Any help would be appreciated.

Steve

Share this post


Link to post
Share on other sites



I am trying to get a list of all the computers on my network. I have done the easy bit and got a list of the Computer Names, but have not been able to get the associated Computer Descriptions. Any help would be appreciated.

Steve

Give this a shot. If you have all of the machine names in an array, you can just do a For...Next to handle changing $strComputer for each machine.

CODE

Const $HKEY_LOCAL_MACHINE = 0x80000002

$strComputer = "."

Dim $strDescription

$objRegistry = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv")

$strKeyPath = "System\CurrentControlSet\Services\lanmanserver\parameters"

$strValueName = "srvcomment"

$objRegistry.GetStringValue ($HKEY_LOCAL_MACHINE, $strKeyPath, $strValueName, $strDescription)

ConsoleWrite($strDescription &@CRLF)


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

@Monamo, will this work for anything but the local machine?

I was going to suggest:

; Generated by AutoIt Scriptomatic
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Description=""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
   For $objItem In $colItems
      $Description = $objItem.Description & @CRLF
      ExitLoop
   Next
EndIf
MsgBox(0, "test", $Description )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0