|
|
|||||||
I'm trying to get an idea for who in the office is running something less than MS Office 2003. Is there a reg key or something I can query to determine not only the version of Office running on the client, but the service pack level? Thanks! |
||||||||
|
|
|||||||
Have you searched the UDF library? I seem to recall Doc posting something along these lines a while back. Glenn |
||||||||
|
|
|||||||
Yep, posted a couple of them. This is probably the one you would want. GetOfficeDetails2() This is the main page for the UDFs where you can find over 600 pre-written script functions. UDF Library |
||||||||
|
|
|||||||
If you want to do it yourself
|
||||||||
|
|
|||||||
okay, i like that method. can you remind me how i "recurse" through that key to make the match on Microsoft Office in the Display Name field and then to also return the DisplayVersion? thanks. |
||||||||
|
|
|||||||
or, using the function, this is what i am doing and it is not working: Dim $MSO_Ver $MSO_Ver = GetOfficeDetails2() $rc Open (9, "\\servershare\Office_Versions.csv", 5) $rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $MSO_Ver + @CRLF) $rc = close(9) it's telling me "this type of array not supported in expressions." any idea? |
||||||||
|
|
|||||||
okay, i was able to get it to output to the screen by this: for each $item in GetOfficeDetails2() ? $item next however, the output is this: 10.0.6789.0 10.0.6802.0 10.0.6819.0 10.0.6771.0 10.0.6615.0 Microsoft Office XP Professional What does all that mean? |
||||||||
|
|
|||||||
|
||||||||
|
|
|||||||
this works beautifully. thanks! |
||||||||
|
|
|||||||
so, while this works great, i'm now trying to exclude a workstation from running this portion of the script. Here's how I'm doing it and it's not working. Any idea? Code: IF WKSTA <> name Dim $RC ;$RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf ;Declare variables Dim $UninstallKey, $Count, $Key, $Value ;Initialize variables $UninstallKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $Count = 0 ;Code $Key = EnumKey($Uninstallkey, $Count) While @ERROR = 0 ;? $Key $DispName = ReadValue($Uninstallkey+'\'+$Key,"DisplayName") $DispVer = ReadValue($Uninstallkey+'\'+$Key,"DisplayVersion") If InSTR($DispName, "Microsoft Office") $rc = Open (9, "\\irvineefa01\kixtart_log\Office_Versions.csv", 5) $rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $DispName + "," + $DispVer + "," + $item + @CRLF) $rc = close(9) EndIf $Count = $Count + 1 $Key = EnumKey($Uninstallkey, $Count) Loop ENDIF |
||||||||
|
|
|||||||
1. Learn to use the code tags. Makes your code much easier to read. 2. Your IF statement is wrong. IF @WKSTA <> "name" |
||||||||
|
|
|||||||
You could also experience a problem with your WriteLine if items such as "@FULLNAME" contains a comma. You should use a "real" CSV format, which detects any data that contains commas and encloses them in quotes. Look for the CSV function, which translates between an array of data and a CSV formatted string. Using it, you can do something like Code: $CSVarray = @TIME, @DATE, @WKSTA, @USERID, @fullname, $DispName, $DispVer, $item $Rc = WriteLine(9, CSV($CSVarray) + @CRLF) Glenn |
||||||||
|
|
|||||||
hi, i put the workstation name in quotes (IF @WKSTA <> "name"), but it is still being included. |
||||||||
|
|
|||||||
Originally Posted By: endodave hi, i put the workstation name in quotes (IF @WKSTA <> "name"), but it is still being included. Did you also put the "@" in front of WKSTA? It is missing in the code that you posted above. |
||||||||
|
|
|||||||
here is the code copied from the kix file: Code: IF @WKSTA <> "DWF5Q8101C20" Dim $RC ;$RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf ;Declare variables Dim $UninstallKey, $Count, $Key, $Value ;Initialize variables $UninstallKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $Count = 0 ;Code $Key = EnumKey($Uninstallkey, $Count) While @ERROR = 0 ;? $Key $DispName = ReadValue($Uninstallkey+'\'+$Key,"DisplayName") $DispVer = ReadValue($Uninstallkey+'\'+$Key,"DisplayVersion") If InSTR($DispName, "Microsoft Office") $rc = Open (9, "\\irvineefa01\kixtart_log\Office_Versions.csv", 5) $rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $DispName + "," + $DispVer + "," + $item + @CRLF) $rc = close(9) EndIf $Count = $Count + 1 $Key = EnumKey($Uninstallkey, $Count) Loop ;;;;;;;;;;;;; ; ; ; End ; ; ; ;;;;;;;;;;;;; ENDIF |
||||||||
|
|
|||||||
Hi endodave When you post code please place that code in code tags, here is a link that will help you with that, The Post/Reply Formatting Box and How to use it |
||||||||
|
|
|||||||
Here is another, but it returns more data than I want... Can I do a WHERE clause that contains OR?? Where Name="this" or name="that"? Code: $objWMI = GetObject("winmgmts:\\.\root\CIMV2") $colItems = $objWMI.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office%'") For Each $objItem In $colItems ? '1 '+ $objItem.Name ? '2 '+ $objItem.InstallLocation ? '3 '+ $objItem.Version ? '4 '+ $objItem.IdentifyingNumber ? Next |
||||||||
|
|
|||||||
Originally Posted By: Radimus Here is another, but it returns more data than I want... Can I do a WHERE clause that contains OR?? Where Name="this" or name="that" Eh? Using an OR is going to return more results, not less Anyway, a simple OR syntax is pretty much what you would expect: Code: $objWMI = GetObject("winmgmts:\\.\root\CIMV2") $colItems = $objWMI.ExecQuery("SELECT * FROM Win32_Product" +" WHERE Name Like 'Microsoft Office Visio Professional%'" +" OR Name Like 'Microsoft Office Professional%'" ) For Each $objItem In $colItems '1 '+ $objItem.Name+@CRLF '2 '+ $objItem.InstallLocation+@CRLF '3 '+ $objItem.Version+@CRLF '4 '+ $objItem.IdentifyingNumber+@CRLF @CRLF Next |
||||||||
|
|
|||||||
I wound up doing this: Code: ? @time $objWMI = GetObject("winmgmts:\\.\root\CIMV2") $colItems = $objWMI.ExecQuery("SELECT * FROM Win32_Product WHERE Name='Microsoft Office Enterprise 2007' or Name='Microsoft Office Professional Plus 2007'") For Each $objItem In $colItems ? '1 '+ $objItem.Name ? '2 '+ $objItem.InstallLocation ? '3 '+ $objItem.Version ? '4 '+ $objItem.IdentifyingNumber ? Next ? @time $MSOKey = iif(keyexist("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120000-0030-0000-0000-0000000FF1CE}"),'{90120000-0030-0000-0000-0000000FF1CE}','{90120000-0011-0000-0000-0000000FF1CE}') $MSOType = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"DisplayName") $MSOdir = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"InstallLocation") $MSOVer = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"DisplayVersion") $MSOMajor= Split($MSOVer,'.')[0] $MSOMinor= Split($MSOVer,'.')[2] ? ? $MSOType ? $MSOdir ? $MSOver ? $MSOMajor ? $MSOMinor ? ? @time ? ? 'press enter to end' gets $k |
||||||||
|
|
|||||||
Well WMI is pig slow, but going forward with Vista and Windows 7 it sure seems like we're going to be stuck using them to get past the security of the OS to do scripting. |
||||||||
|
|
|||||||
Endodave, Here is some code that may help exclude the one computer from this script. Change it as needed... Code: $COMPUTERNAME=@HOSTNAME IF $COMPUTERNAME="BURRITO" OR $COMPUTERNAME="BURRITO.DOMAIN.DOM" $MSINTERNETEXPLORERSPSTATUS="VALID" ENDIF |