Adventures in Powershell. These posts have been created as a record of the successful powershell commands I have used.
Monday, December 4, 2017
Read Registry keys using WMI
This code can retrieve the registry values of specified keys using WMI
$objReg = [WMIClass] "\\$TargetName\root\default:StdRegProv"
$HKEY_LOCAL_MACHINE = 2147483650
""
"WMI/Registry Reported App-V Client Version"
$AppVClientVersion = $null
$TargetKey = "SOFTWARE\Microsoft\AppV\Client"
$TargetKeyData="Version"
$TargetValue = $objReg.GetStringValue($HKEY_LOCAL_MACHINE, $targetkey, $targetkeydata)
$AppVClientVersion = $TargetValue.sValue
if ($AppVClientVersion -notlike $null)
{
$AppVClientVersion
}
else
{"AppV Client Version Value Not Found"
}
The number codes for the other registry locations are:
HKEY_CLASSES_ROOT (2147483648)
HKEY_CURRENT_USER (2147483649)
HKEY_LOCAL_MACHINE (2147483650)
HKEY_USERS (2147483651)
HKEY_CURRENT_CONFIG (2147483653)
Tuesday, April 11, 2017
Current Folder
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
Add-AppvClientConnectionGroup $scriptDir"\CGDEF_WINPROJ.xml"
Enable-AppvClientConnectionGroup "Winproj Add-ins" -global
Subscribe to:
Posts (Atom)