Welcome › Forums › General PowerShell Q&A › PS3 2nd ed; Month of Lunches CH 9 Pipeline deeper (Get-Service)
This topic contains 2 replies, has 2 voices, and was last updated by
I can successfully return my 2012 R2 DCs using this:
Get-ADComputer -Filter * -SearchBase "ou=domain controllers,dc=myCompany,dc=com"
but when trying to run this from page 113
Get-Service -ComputerName (Get-ADComputer -Filter * -SearchBase "ou=domain controllers,dc=myCompany,dc=com" | Select-Object -Expand name)
...I get error:
Get-Service : Cannot open Service Control Manager on computer 'DC1'. This operation might require other privileges.
I am logged onto a DC as my DA account. I launched PS as "Administrator".
Also, the example on pg 116 fails as well with a similar error
Get-Process -ComputerName (Import-Csv .\temp\computers.csv | select -ExpandProperty hostname)
Get-Process : Couldn't connect to remote machine.
..even though the Import-csv outputs my DCs contained in the csv
I have to get past the access denied errors in order to make use good progress with this book.
You probably don't want to use the computername switch when you're logged onto a dc. Try it from your desktop using runas. It works for me however the output isn't even practical so I don't know why it would be included as an example.
thanks Dan...Run As "my DA account" worked for both gp and gsv examples in this chapter.
1) I have a desktop that I log into as a non-privileged user
2) I launched PS with run as "my DA account" in order execute PS queries against DC's processes and services.
I think the output is not the point other than showing the benefit of the extended piping to PS newbies like me.
The topic ‘PS3 2nd ed; Month of Lunches CH 9 Pipeline deeper (Get-Service)’ is closed to new replies.