Powershell v3.0 pipe issue Powershell v3.0 pipe issue powershell powershell

Powershell v3.0 pipe issue


I found an article that may help.

http://technet.microsoft.com/en-us/library/ee617224.aspx

From the look of your script you are providing the server using the text file. Is it possible the problem is the Windows 2008 server you are running the PowerShell script on is not in the same domain or the user you are logged in as does not have access to the domains where the other servers are members?

snippet from the above article:

-If the Server parameter is specified and the Credential parameter is not specified: --The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the LocalComputer or LoggedOnUser. Then the credentials of the current logged on user are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.

You might try adding the additional parameters for the Get-ADDomain commandlet such as -Identity, -AuthType, and -Credential

Get-ADDomain [-Identity] [-AuthType { | }] [-Credential ] [-Server ] []


Powershell v3.0 pipe issue

I just tried to run the cmdlet 'gc .\text.txt | Get-ADDomain' from a virtual Server 2008 R2 box that I have. I built a text file in the following format:

 Domain1 Domain2 Domain3

One thing to be sure of is that each domain is on it's own line in the text file. I can understand why the one syntax worked when you piped the STDOUT to:

%{ Get-ADDomain $_} 

because you are looping through all the information contained in the text file and only have the cmdlet work on a single value at a time. Unfortunately I don't have the RSAT package on my Win 8 desktop, so I can't test from my desktop. Hopefully this helps a little bit.