Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 16 Jul 2008 18:45:01 -0700,    group: microsoft.public.dotnet.framework.wmi        back       


memory and hard disk lookup   
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
date: Wed, 16 Jul 2008 18:45:01 -0700   author:   Josie

RE: memory and hard disk lookup   
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

"Josie" wrote:

> 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
>
date: Mon, 21 Jul 2008 11:57:00 -0700   author:   Josie

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us