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
Suppress GET-ADComputer output
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Suppress GET-ADComputer output
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
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Suppress GET-ADComputer output
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?
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
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.
- waynecierkowski
- Posts: 28
- Last visit: Mon Jul 10, 2023 10:51 am