Page 1 of 1

Suppress GET-ADComputer output

Posted: Tue Nov 10, 2015 1:54 pm
by waynecierkowski
Product, version and build: PowerShell Studio 2015
32 or 64 bit version of product: 64 bit
Operating system: Windows 8.1
32 or 64 bit OS: 64 bit

Hi,

I am creating a Backup Audit for my company and to get all the known Servers in our organization I am going against Active Directory. I have imported the Active Directory module into my program. I then issue the Get-ADComputer cmdlet and store the results into a variable that I can work with.

When the command runs after I build my program I have output coming out which looks like a AD Structure.

Sample:

Issuing Get-ADComputers command
CN=HCUSSB300,OU=Domain Controllers,DC=hcpna,DC=dmz CN=HCUSSC313,OU=GroupPolicyExclusions,DC=hcpna,DC=dmz CN=HCUSSC323,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC322,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSB301,OU=Domain Controllers,DC=hcpna,DC=dmz CN=HCUSSC326,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC309,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC303,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC302,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC325,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC308,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC320,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSC306,CN=Computers,DC=hcpna,DC=dmz CN=HCUSSB399,OU=DMZMemberServers,DC=hcpna,DC=dmz CN=HCUSSB193,OU=DMZMemberServers,DC=hcpna,DC=dmz CN=HCUSSB302,OU=DMZMemberServers,DC=hcpna,DC=dmz CN=HCUSSB310,OU=DMZMemberServers,DC=hcpna,DC=dmz

Actual command being issued:

$HCPServers = Get-ADComputer -Filter { OperatingSystem -Like "Windows Server*" } -Property *

Is there a way to suppress this output?

TIA...

Wayne

Re: Suppress GET-ADComputer output

Posted: Fri Nov 13, 2015 1:51 pm
by davidc
I moved this over to the Windows PowerShell forum so that an community expert in AD can provide assistance as to where this output is coming from.

David

Re: Suppress GET-ADComputer output

Posted: Fri Nov 13, 2015 2:19 pm
by jvierra
What Output is it that you don't want?

Re: Suppress GET-ADComputer output

Posted: Fri Nov 13, 2015 5:01 pm
by jvierra
I cannot reproduce you issue in any normal way.
If I run your line of code I get no output. It I run the code like this I get your output:

$HCPServers = Get-ADComputer -Filter { OperatingSystem -Like "Windows Server*" } -Property *

$HCPServers | %{"$_"}
That will produce your output and it is correct.

What is the code that you are using?

Re: Suppress GET-ADComputer output

Posted: Tue Nov 17, 2015 4:20 am
by cogenc
Try piping it to Out-Null. This should accomplish what you're trying to do. If it doesn't, let me know. I'm pretty familiar with the ActiveDirectory Module and am happy to help.

Re: Suppress GET-ADComputer output

Posted: Wed Dec 02, 2015 1:17 pm
by waynecierkowski
Thanks I'll give that a try and let you know...