joukiejouk
asked on
Need help to run a query via PSEXEC to look for a registry key and export the result to a text file.
Need help to run a query via PSEXEC . I've been tasked to do the following:
John's request:
Bill's response (A network admin):
I am the system admin who need to complete task above but do not have strong skills in scripting. If I can come up with something via PSEXEC, that would be great. If there's a better approach, fill me in. Using the scenario/example above, can someone help me write a script via PSEXEC?
John's request:
Bill's response (A network admin):
I am the system admin who need to complete task above but do not have strong skills in scripting. If I can come up with something via PSEXEC, that would be great. If there's a better approach, fill me in. Using the scenario/example above, can someone help me write a script via PSEXEC?
ASKER
Dont I need to put abc.com somewhere in the script? I want to run the command against our AD to look for all machines that might have that regisry key.
Here is what I am getting when i ran your command.
Here is the string if you need to use it for the command:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows\ CurrentVer sion\Unins tall\{9015 0000-008F- 0000-1000- 0000000FF1 CE}
Here is what I am getting when i ran your command.
Here is the string if you need to use it for the command:
HKEY_LOCAL_MACHINE\SOFTWAR
Sorry I misread the syntax.
It should be:
It should be:
for %i in (computer1, computer2, computer3) DO REG Query \\%i\HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-008F-0000-1000-0000000FF1CE} /v Displayname
for /l in %i in (1,1,99) DO REG Query \\computer%i\HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{90150000-008F-0000-1000-0000000FF1CE} /v Displayname
ASKER
How would I run this query against a domain controller (e.g. - abc.com) or a certain OU? Let's say the OU is (e.g. - TEST). I need to query all machines within the domain. That is the challenge. Can you share the command given the scenario as mentioned?
ASKER
Any Expert have any other suggestion?
I wish experts exchange was more consistent with their notification emails. They keep changing them and I missed the responses.
You don't need to be on the domain controller. You just need to run it with an admin account that has Local administrator privileges.
As for getting computers, you would run powershell.
$ou = "OU=Workstations,OU=Comput ers,DC=MyD omain,DC=c om"
$Computers = Get-ADComputer -Filter '*' -SearchBase $ou
$Computers | Foreach { $_.DNSHostName } | Out-File -Filepath "output.txt"
You don't need to be on the domain controller. You just need to run it with an admin account that has Local administrator privileges.
As for getting computers, you would run powershell.
$ou = "OU=Workstations,OU=Comput
$Computers = Get-ADComputer -Filter '*' -SearchBase $ou
$Computers | Foreach { $_.DNSHostName } | Out-File -Filepath "output.txt"
Did this ever work out for you?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
REG Query HKLM\Software\Microsoft\Wi
Since you made a picture instead of cutting and pasting the string, I'm not going to try and eyeball it and type that out. You can figure it out yourself.
Put that in a for loop
Open in new window
If your have name in numerical sequence:
Open in new window