$PCName = (Get-ADComputer -Filter * -SearchBase "OU=baker,OU=MGWorkstations,dc=acme,dc=org").Nameforeach ($machine in $PCName) {(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' -Name RebootUtility).RebootUtility}
The above code when run only writes out the registry key information from my local PC. I have "this is a test" in my reg key and that is all it returns and it returns this 23 times, which is the number of machines in OU=baker. I did a get-help on get-itemproperty and there does not seem to be a -ComputerName switch. how do I read a reg key of remote machines and see the output?
I've googled this but most code I've found pulls the reg reads from the LocalMachine.