#153930 - 2005-12-22 07:50 PM
Re: Help with arithmatic operations using variables
|
jwmac
Fresh Scripter
Registered: 2005-12-22
Posts: 5
|
Thats Perfect! Brilliant! I new there would be a simple solution. Thank you. I also have the round command down now so I'm good to go til next week. I have several more questions.
thanks again
My script so far(cramped because of cut and paste): Quote:
break on
$InvCheck = READVALUE ("HKEY_LOCAL_MACHINE\HARDWARE\IT Inventory", "Stamp") If $InvCheck = 1 Goto End Else cls
? "Performing an inventory of this computer... please wait..." ? " Thank you!" sleep 2
$WMI = "WINMGMTS:{IMPERSONATIONLEVEL=IMPERSONATE}!//@WKSTA" $ComputerModel = GetObject($WMI).ExecQuery("Select * FROM Win32_ComputerSystem") $FindBIOSInfo = GetObject($WMI).ExecQuery("Select * FROM Win32_BIOS") $DiskSet = GetObject($WMI).ExecQuery("SELECT * FROM WIN32_LOGICALDISK WHERE DriveType=3") $mem = memorysize(0) $netinfoip = ENUMIPINFO (0, 0, 1) $netinfonic = ENUMIPINFO (0, 2, 1) For Each $model in $ComputerModel $CompModel = $model.model Next
For Each $tag in $FindBIOSInfo $servicetag = $tag.SerialNumber Next
$TotalSpace = 0.0 $FreeSpace = 0.0
For Each $Disk in $DiskSet $DriveName = $Disk.Name $FreeSpace = $FreeSpace + $Disk.FreeSpace $TotalSpace = $TotalSpace + $Disk.Size $Format = $Disk.FileSystem Next
$TotalSpaceGigs = $totalspace / 1073741824 $FreeSpaceGigs = $FreeSpace / 1073741824
REDIRECTOUTPUT ("@LServer\inventory$\inventory.csv")
? @Date", "@Time", "@Site", "@LServer", "@WKsta", "$Servicetag", "@WUserID", "@Producttype", "@CSD", "@CPU", "@MHz", "$mem", "$DriveName", "Round ($FreeSpaceGigs,1)", "Round ($TotalSpaceGigs,1)", "$Format", "$netinfoip", "@Address", "$netinfonic
REDIRECTOUTPUT ("@LServer\inventory$\inventory.log") ? "**********Computer: "+@WKsta"**Site: "+@Site"*************" ? @Date ? @Time ? @Site ? @LServer ;logon server ? @WKsta ? $CompModel ? $Servicetag ? @WUserID ;username ? @Producttype" w/ "@CSD ? @CPU ? @MHz"MHz" ? $mem"MB" ? $DriveName ? Round ($FreeSpaceGigs,1) ? Round ($TotalSpaceGigs,1) ? $Format ? $netinfoip ? @Address ? $netinfonic ? $WMI = 0
WRITEVALUE ("HKEY_LOCAL_MACHINE\HARDWARE\IT Inventory", "Stamp", "1", "REG_SZ") WRITEVALUE ("HKEY_LOCAL_MACHINE\HARDWARE\IT Inventory", "Date", "@Date", "REG_SZ")
Redirectoutput ("") cls ? "Inventory Complete!" sleep 2 :end exit
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 525 anonymous users online.
|
|
|