|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Script to find the presence of a softwareI need a script that finds the presence of a particular software (let us say MS Office ) in all the machines listed in a text file. I have a script which gives the output of all installed softwares in local computer. Can someone tell me what are the modifications i must do in this script to get the result for my scenario. ' Script To get installed software info and save it to a text file. ' strHost = "." Const HKLM = &H80000002 Set objReg = GetObject("winmgmts://" & strHost & _ "/root/default:StdRegProv") Const strBaseKey = _ "Software\Microsoft\Windows\CurrentVersion\Uninstall\" objReg.EnumKey HKLM,strBaseKey,arrSubKeys For Each strSubKey In arrSubKeys intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ "DisplayName",strValue) If intRet <> 0 Then intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ "QuietDisplayName",strValue) End If If (strValue <> "") and (intRet = 0) Then set fs = CreateObject("Scripting.FileSystemObject") logfile = "C:\Software.txt" set handle = fs.OpenTextFile(logfile,8,true) softwareName = strValue handle.WriteLine softwareName handle.close End If Next -- coolguy123 ------------------------------------------------------------------------ coolguy123's Profile: http://forums.techarena.in/members/coolguy123.htm View this thread: http://forums.techarena.in/server-scripting/1129087.htmhttp://forums.techarena.in Can someone help me in this...?
--
coolguy123
------------------------------------------------------------------------
coolguy123's Profile: http://forums.techarena.in/members/coolguy123.htm
View this thread: http://forums.techarena.in/server-scripting/1129087.htmhttp://forums.techarena.in
Show quote
Hide quote
"coolguy123" <coolguy123.3o3pfb@DoNotSpam.com> wrote in message I would suggest something similar to:news:coolguy123.3o3pfb@DoNotSpam.com... > > Hi, > > I need a script that finds the presence of a particular software (let > us say MS Office ) in all the machines listed in a text file. I have a > script which gives the output of all installed softwares in local > computer. Can someone tell me what are the modifications i must do in > this script to get the result for my scenario. > > ' Script To get installed software info and save it to a text file. > ' > strHost = "." > > Const HKLM = &H80000002 > Set objReg = GetObject("winmgmts://" & strHost & _ > "/root/default:StdRegProv") > Const strBaseKey = _ > "Software\Microsoft\Windows\CurrentVersion\Uninstall\" > objReg.EnumKey HKLM,strBaseKey,arrSubKeys > > For Each strSubKey In arrSubKeys > intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ > "DisplayName",strValue) > If intRet <> 0 Then > intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ > "QuietDisplayName",strValue) > End If > If (strValue <> "") and (intRet = 0) Then > set fs = CreateObject("Scripting.FileSystemObject") > logfile = "C:\Software.txt" > set handle = fs.OpenTextFile(logfile,8,true) > > > softwareName = strValue > handle.WriteLine softwareName > handle.close > End If > Next > ========= strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSoftware = objWMIService.ExecQuery _ ("SELECT * FROM Win32_Product WHERE Name = 'MyApp'") ========= Otherwise, you would need to check for the application name in the loop where you enumerate arrSubKeys. Perhaps: ======= set fs = CreateObject("Scripting.FileSystemObject") logfile = "C:\Software.txt" set handle = fs.OpenTextFile(logfile,8,true) For Each strSubKey In arrSubKeys intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ "DisplayName",strValue) If intRet <> 0 Then intRet = objReg.GetStringValue(HKLM,strBaseKey & strSubKey,_ "QuietDisplayName",strValue) End If If (strValue <> "") and (intRet = 0) Then If (strValue = "MyApp") Then softwareName = strValue handle.WriteLine softwareName End If End If Next handle.close ====== I also moved the opening and closing of the log file outside the loop. It only needs to be done once, not for every strSubKey in arrSubKeys. In any case, you will need test to see exactly what the application name is in your case.
modify incremental_backup
Script to set share permissions on home directories Drop leading zeros in a variable Deleting and re-installing printer with new name using login scrip Echo to column position Script to set user permissions Undefined variable in login script Scruot to check user rights on folders/subfolders startup scripting folder permission |
|||||||||||||||||||||||