‘Inparams.Svaluename = “QuietDisplayName” ‘set Outparams = objStdRegProv.ExecMethod_(“GetStringValue”, Inparams,objCtx) ‘wscript.echo Outparams. Get the output for the command wmic product get name using subprocess. If (“” & Outparams.sValue) = “” then ‘wscript.echo strSubKey Else wscript.echo Outparams.SValue End iF Let’s see the logic, if we run this wmic product get name code into our terminal then we got like this: Let’s write the Python code to get installed software list information. Set Inparams = objStdRegProv.Methods_(“GetStringValue”).Inparameters Inparams.Hdefkey = HKLM Inparams.Ssubkeyname = “Software\Microsoft\Windows\CurrentVersion\Uninstall\” & strSubKey Inparams.Svaluename = “DisplayName” set Outparams = objStdRegProv.ExecMethod_(“GetStringValue”, Inparams,objCtx) All WMI objects and their properties, including their methods, are accessible through the shell, which makes WMIC an advanced systems management console. Set Outparams = objStdRegProv.ExecMethod_(“EnumKey”, Inparams,objCtx) In its simplest form, WMIC is a utility that allows you to interact with WMI from a WMI-aware command-line shell. ’ Use ExecMethod to call the GetStringValue method Set Inparams = objStdRegProv.Methods_(“EnumKey”).Inparameters Inparams.Hdefkey = HKLM Inparams.Ssubkeyname = “Software\Microsoft\Windows\CurrentVersion\Uninstall\” WScript.Echo “64-bit Applications” WScript.echo “-“ wmic /node:COMPUTERNAME product get name,version,vendor >output.txt use >instead of > to append to a file. ObjCtx.Add “_ProviderArchitecture”, 64 objCtx.Add “_RequiredArchitecture”, TRUE Set objLocator = CreateObject(“Wbemscripting.SWbemLocator”) Set objServices = objLocator.ConnectServer(“”,”root\default”,””,””,objCtx) Set objStdRegProv = objServices.Get(“StdRegProv”) WScript.Echo “32-bit Applications” WScript.echo “-“ StrComputer = “.” Const HKLM = &h80000002 Set objCtx = CreateObject(“WbemScripting.SWbemNamedValueSet”) objCtx.Add “_ProviderArchitecture”, 32 objCtx.Add “_RequiredArchitecture”, TRUE Set objLocator = CreateObject(“Wbemscripting.SWbemLocator”) Set objServices = objLocator.ConnectServer(“”,”root\default”,””,””,objCtx) Set objStdRegProv = objServices.Get(“StdRegProv”) Here’s some VBScript that will list first the 32-bit and then 64-bit installed applications: VBS file) to list separately the 32-bit and 64-bit in one run: If prompted, enter your Windows account password. Right-click it and select 'Run As Administrator' from the window that appears. Command Prompt will appear in the search results. I would recommend the next VBS script (simple save on a. To do this, type 'cmd' in the Windows search bar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |