Solved Query Regsitry using a Variable
-
Hey All, Hoping I can get some help as I'm just not thinking straight.
I want to be able to use
reg query $variablePathName /f /InstallDate /s
But I'm being told that $VariablePathName isn't a valid path (no dur) yet it is if I run the prior command which gives me the path.
How can I use
reg query
to search using a variable? -
Get-ChildItem -path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' | W here-Object -FilterScript { $_.GetValue("DisplayName") -eq 'Software' }
Gets me the content I want, now I gotta filter out how I can pull just the single string I need...
-
Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Software" #or Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -Match "Software"
-
@Obsolesce Yeah I got that far along, what I need to pull is a specific string from the output.
I have a few other ways that I was manipulating the string, like writing the entire output to a file and then pulling the 23rd line (for example) but that literally gets everything on that line.
When all I want is the InstallDate
-
@DustinB3403 said in Query Regsitry using a Variable:
@Obsolesce Yeah I got that far along, what I need to pull is a specific string from the output.
I have a few other ways that I was manipulating the string, like writing the entire output to a file and then pulling the 23rd line (for example) but that literally gets everything on that line.
When all I want is the InstallDate
Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge" | Select-Object -Property InstallDate $InstallDate = Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge" | Select-Object -Property InstallDate $InstallDate $InstallDate.InstallDate
-
@DustinB3403 depending on what you want, you can also:
$app = Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge" $installDate = $app.InstallDate
-