Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

memory and hard disk lookup

0 views
Skip to first unread message

Josie

unread,
Jul 16, 2008, 9:45:01 PM7/16/08
to
I am having trouble comparing memory and free hard disk space with my
requirements. I am not sure how to calculate the amount of memory or free
hard disk space that WMI has. Below is what I have so far

Set wshShell = WScript.CreateObject("WScript.Shell")

Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")

Set colComputer = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem")

Set colDisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk
Where DeviceID = 'C:'")

For Each objSoftware In colSoftware
If objSoftware.Caption = "Microsoft Office Enterprise" Then
OfficeInstalled = True
Exit For
End If

Next

For Each objComputer In colComputer

If (objComputer.TotalPhysicalMemory /(1024)) < "500" Then
AmountOfMemory = True
Exit For
End If

Next

For Each objDisk In colDisks

If (objDisk.FreeSpace /(1024)) < "1000" Then
AmountOfHDSpace = True
Exit For
End If

Next

If OfficeInstalled <> True AND AmountOfMemory = True AND AmountOfHDSpace =
True Then


Set oExec = wshShell.Exec("\\servername\OfficeProPlus2007\setup.exe")
Do While oExec.Status = 0
WScript.Sleep 100


Loop

End If

Josie

unread,
Jul 21, 2008, 2:57:00 PM7/21/08
to
This is what if figured out to get it work.

Set wshShell = WScript.CreateObject("WScript.Shell")

Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")

Set colComputer = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem")

Set colDisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk
Where DeviceID = 'C:'")

For Each objSoftware In colSoftware

If objSoftware.Caption = "Microsoft Office Professional Plus 2007" Then


OfficeInstalled = True
Exit For
End If

Next

For Each objComputer In colComputer

intRamGB = int(objComputer.TotalPhysicalMemory)

If int(objComputer.TotalPhysicalMemory /(1073741824)) > ".5" Then


AmountOfMemory = True
Exit For
End If

Next

For Each objDisk In colDisks

intDISKGB = int(objDisk.FreeSpace)

If int(objDisk.FreeSpace /(1073741824)) > "1" Then


AmountOfHDSpace = True
Exit For
End If

Next

If OfficeInstalled <> True AND AmountOfMemory = True AND AmountOfHDSpace =
True Then


Set oExec = wshShell.Exec("\\servername\OfficeProPlus2007\setup.exe

/adminfile \\servername\OfficeProPlus2007\office3.msp ")


Do While oExec.Status = 0
WScript.Sleep 100


Loop

End If

WScript.Quit

0 new messages