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.
thank you