#71646 - 2002-11-19 07:54 PM
Convert a logon-bat to a domain retreival
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
I've designed a logon script to inventory the hardware on our network. We've found that there are a number of users that do not logoff and on regularly, so now I'm interested in calling out to the machines, but still running the script (since I did so much work to it). is there a way to have it call out and inventory specific machines, via a list file?
code:
; script main If Exist (c:\hardinvn.000) Return Else EndIf Gosub GetWMIInfo Open (2, "\\nt-xxxxxx\logs$\HardwareInventory\hardinve.csv", 4) = 0 WriteLine (2, @WKSTA + "," + $WMIManufacturer + "," + $WMIModel + "," + $WMIModelVersion + "," + $WMIManufacturer2 + "," + $WMIBiosSernum + "," + $WMICPUCurrentClockSpeed + "," + $WMITotalPhysicalMemory + "," + $WMICDriveSize + "," + $WMICDriveFreeSpace + "," + $WMIDisplayDescription + "," + $WMINICName + "," + $WMISoundCard + "," + $WMICDRom + "," + @PRODUCTTYPE + "," + @CSD + @CRLF) ;Else ; ? "Failed to open file" Close (2) Open (1, c:\hardinvn.000, 5) Close (1) Return Exit ; main end
;*************************** ;* sub GetWMIInfo * ;*************************** :GetWMIInfo If @INWIN$ = 1 $WMIManufacturer = Rtrim(WMIQuery("Manufacturer", "Win32_ComputerSystem")) $WMIModel = Rtrim(WMIQuery("Model", "Win32_ComputerSystem")) $WMIManufacturer2 = Rtrim(WMIQuery("Version", "Win32_ComputerSystemProduct")) $WMIBiosVersion = Rtrim(WMIQuery("Version", "Win32_BIOS")) $WMIBiosSernum = Rtrim(WMIQuery("SerialNumber", "Win32_BIOS")) $WMISMBIOSVersion = Rtrim(WMIQuery("SMBIOSVersion", "Win32_BIOS")) $WMICPUCurrentClockSpeed = Rtrim(WMIQuery("CurrentClockSpeed", "Win32_Processor")) $WMITotalPhysicalMemory = Rtrim(WMIQuery("TotalPhysicalMemory", "Win32_LogicalMemoryConfiguration")) $WMICDrive = Rtrim(WMIQuery("Caption", "Win32_LogicalDisk")) If InStr($WMICDrive,"|") For Each $Return in Split($WMICDrive,"|") If $Return $WMICDrive=$Return EndIf Next EndIf $WMICDriveSize = Rtrim(WMIQuery("Size", "Win32_LogicalDisk")) If InStr($WMICDriveSize,"|") For Each $Return in Split($WMICDriveSize,"|") If $Return $WMICDriveSize=$Return EndIf Next EndIf $WMICDriveFreeSpace = Rtrim(WMIQuery("FreeSpace", "Win32_LogicalDisk")) If InStr($WMICDriveFreeSpace,"|") For Each $Return in Split($WMICDriveFreeSpace,"|") If $Return $WMICDriveFreeSpace=$Return EndIf Next EndIf $WMIDisplayDescription = Rtrim(WMIQuery("Description", "Win32_DisplayControllerConfiguration")) $WMINICName = Rtrim(WMIQuery("Caption", "Win32_NetworkAdapterConfiguration")) If InStr($WMINICName,"|") For Each $Return in Split($WMINICName,"|") If $Return $WMINICName=$Return EndIf Next EndIf $WMISoundCard = Rtrim(WMIQuery("Caption", "Win32_SoundDevice")) $WMICDRom = Rtrim(WMIQuery("Caption", "Win32_CDROMDrive")) If InStr($WMICDRom,"|") For Each $Return in Split($WMICDRom,"|") If $Return $WMICDRom=$Return EndIf Next EndIf EndIf Return
;*************************** ;* function WMIQuery * ;*************************** Function WMIQuery($what, $where) Dim $strQuery, $objEnumerator, $value $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 AND $objInstance <> "" $junk = Execute("$$value = $$objInstance.$what") $WMIQuery = "$value" + "|" + "$WMIQuery" EndIf Next $WMIQuery = Left($WMIQuery, Len($WMIQuery) - 1) EndFunction
any one have any ideas???? For those of you that have seen/helped my posts before... I have another lawn dart. [ 19. November 2002, 20:27: Message edited by: ArchAngel96 ]
_________________________
penny = the target
the playing field = three football fields side by side
you = only allowed to stand on the outside of the playing field
tool you get to use to find the penny = a ONE INCH LAWN DART
get the level of difficulty?
|
|
Top
|
|
|
|
#71652 - 2002-11-19 09:59 PM
Re: Convert a logon-bat to a domain retreival
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I had to post another reply to get rid of that evil postcount.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 756 anonymous users online.
|
|
|