Running Test-SystemHealth produces Blank Output file Exchange 2010 Server

Exchange Server 2010 SP3 RU8 Enterprise 64 bit
Windows 2008 R2 64 bit

Run this from Powershell

test-systemhealth -adcredentials $c -verbose 2>&1 | out-file "c:\util\test.txt"

Output file is blank  all information is posted on console.

The other thing is how to I pass along the credentials for test-systemhealth


test-systemhealth -adcredentials $c -verbose | FL

This prompts for username and password anyway not to get that to happen?

I tried this $c=get-credential domain\administrator     that prompts me for password

Trying to write this in a script and run every day to send me a report.
LVL 23
Thomas GrassiSystems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
First thing, the -ADCredential is not required. It will use the currently logged in users credentials to perform the command. So if you account has the correct permissions then this is not needed. However to answer your question below would be how to pass the credentials in the command.

$Creds = get-credential domain.com\username
Get-SystemHealth -ADCredentials $Creds -verbose | Out-file c:\results.txt

Open in new window


Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Thanks for the response

1. $Creds = get-credential domain.com\username
This still prompts for password  
If I do not do this I get messages from test-systemhealth  access denied to the DC server

I am logged on as the Domain administrator to this server that is running this.

2. Get-SystemHealth -ADCredentials $Creds -verbose | Out-file c:\results.txt
Results.txt was empty file  all output was posted to console.

This I tried also

$temp=Test-Systemhealth -OutData
Set-Content -Value $temp.filedata -Path c:\util\sh.xml -encoding byte


Thoughts
test.xml
0
Will SzymkowskiSenior Solution ArchitectCommented:
If I do not do this I get messages from test-systemhealth  access denied to the DC server

This is by design. The account that you are currently running this command with does not have the appropriate permissions which is why you are using the -ADCredential parameter. If your account had permissions this is not required. When you get prompted, you are REQUIRED to enter a password for the user account you specified.

Once you have done this you will get the expected output. It is blank output because you did not specify a password, so it uses the local account that you are already logged in with, which does not have permissions.

This is why you are experiencing this.

Will.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Thomas GrassiSystems AdministratorAuthor Commented:
Will

Puzzled

You are thinking that I am getting the local account of this server even tho I am logging on to this server as a domain account?

The domain account does have permissions
not sure about the local account

What permissions do I need here?
0
Will SzymkowskiSenior Solution ArchitectCommented:
LOL
local account of this server even tho I am logging on to this server as a domain account?

No i am talking about the account that you are currently logged in with (DOMAIN ACCOUNT).

As stated, If your account (the one you are currently logged into the server with) has the appropriate permissions then you do NOT need to use the -ADCredential parameter.

 See screenshot below.
dd.JPG
If you have appropriate permissions all you should have to do is run
Test-SystemHealth

Thats it.

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will what command can I use to check to see if this account has the correct permissions?
0
Will SzymkowskiSenior Solution ArchitectCommented:
Take a look at the link below.
https://technet.microsoft.com/en-us/library/dd638114%28v=exchg.141%29.aspx

test-systemhealth requires Organization Management and Server Management

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Great

Will check this out and post back later.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Update

I added my account and the administrator to the rolegroups 'server management' and 'Organization Management'

Still same results

1. need credtentials or I get access denied on DC
2. Still no output report just to console

I do not understand why I am having so much trouble with missing cmdlets and cmdlets that do not function correctly.

I can post get-rolegroup info if you think that will help

I checked Active Directory on my DC and the AD Users & Groups Microsoft Exchange Security contains all the exchange security groups and Server Management and organization management shows my account and administrator as members of

Do I need to logout then back on?

Do I need to restart any services?

Thoughts?
0
Will SzymkowskiSenior Solution ArchitectCommented:
Once again, I have answered the question, but based on your environment there seems to be replication issues or something weird going on.

cmdlets are available to users with proper permissions. If Active Directory is not replicating properly i.e. directory partitions you will have major issues. Unfortunately I think there might be an underlying issue with your active directory setup. As for this question I have answered it based on the settings that are required.

Personally I would start by running the following commands on your domain contollers to check the health and replication.
- repadmin /replsum
- repadmin /showrepl
- repadmin /bridgeheads
- DCDiag /v
- Netdom query dc
- Netdom query fsmo

I would also run the active directory Best Practice Analyzer to see what it detects about your current environment.
https://technet.microsoft.com/en-us/library/dd391875(v=ws.10).aspx

As for this question, close it as I answered your question and open a new question regarding your AD health.

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

I run those programs weekly get an emailed report from both my DCs

They are clean once in a while I get a minor issue because one of the server was restarted


BPA is for windows 2008 I run Windows 2003 DC's


Not sure why it is an AD issue when when I run a get-rolegroup  "organization management" or get-rolegroup  "server management"  the list shows my domain account which I use on my windows 7 computer and it also shows the domain account for the administrator which is logged on to  the exchange server .

See attached

I can close this but do not know where to turn next
get-rolegroup.txt
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Lets get back to the beginning of this issue

Running Test-SystemHealth produces Blank Output file Exchange 2010 Server

No output except to console

If we can figure this out then I will open another for the permissions issue.

Ran this    test-systemhealth | out-file c:\results.txt

file has 0 bytes empty


Thoughts
0
Will SzymkowskiSenior Solution ArchitectCommented:
What happens if you just run test-systemhealth without piping it to a txt file? Just allow it to post results to the screen.

Do you get any data?

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Yes I get all the information displayed on the screen.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

I found this on here
http://www.experts-exchange.com/Programming/Misc/Q_23549396.html

test-systemhealth 2>&1 | out-file "c:\util\test.txt"


I tried that still only output to the screen


Thoughts
0
Will SzymkowskiSenior Solution ArchitectCommented:
Did the command work to the screen?

So this is just an issue going to a file?

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Yes to both questions

It has always worked going to the screen

It always has been an issue going to a file.

I run several scripts and they all produce output in txt format I even have a few in .csv format
I even run other test-mailflow >>c:\util\test.txt and test-servicehealth >>c:\util\test.txt  in a scipt job and they work great.

just test-systemhealth is the buggy one here

Thoughts
0
Will SzymkowskiSenior Solution ArchitectCommented:
trgrassijr55,

I have taken a look at this cmdlet in detail and in order to export the data to a text file you do not pipe it to out-file. You need to use the following syntax...
Get-SystemHealth -OutFileLocation "c:\filename.txt"

Open in new window


Or

$temp = test-systemhealth -OutData
Set-Content -Value $temp.FileData -Path d:\temp\SystemHealthOutData.xml -Encoding Byte

Open in new window


Unfortunately there is no easy way to get the results out to a file like it appears on screen. Personally I would just be using the Exchange Best Practices Analyzer.

Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Thomas GrassiSystems AdministratorAuthor Commented:
Will

I agree Exchange BPA is a good way to go.

But this is an automated way of doing just that.

Both your examples above made some headway.

The files now have data.

But not in a readable format.

Your second sample I already did and posted earlier as an attachment ID: 40647155  test.xml
I am just trying to capture the console output here.

This is the console output
[PS] C:\Windows\system32>$temp = test-systemhealth -outdata
WARNING: Storage driver file 'c:\windows\system32\drivers\vhdmp.sys' for 'Microsoft VHD HBA' on server
TGCS025.our.network.tgcsnet.com is more than two years old. Check with your vendor to find out if a newer version is
available. Installed driver details: 6.1.7601.17514 - 20101120222400.162444-300
WARNING: Storage driver file 'c:\windows\system32\drivers\megasas.sys' for 'DELL PERC 6/i Integrated RAID Controller'
on server TGCS025.our.network.tgcsnet.com is more than two years old. Check with your vendor to find out if a newer
version is available. Installed driver details: 4.5.1.64 - 20090713214804.521663-240
WARNING: More than one network interface on server TGCS025.our.network.tgcsnet.com has a default IP gateway listed.
Communication errors may occur if these network connections link to independent subnets.
WARNING: Network interface driver file 'c:\windows\system32\drivers\bxnd60a.sys' for 'l2nd' on server
TGCS025.our.network.tgcsnet.com is more than two years old. Check with your vendor to find out if a newer version is
available. Installed driver details: 4.8.4.0 - 20090610163426.409397-240
WARNING: Network interface driver file 'c:\windows\system32\drivers\bxnd60a.sys' for 'l2nd' on server
TGCS025.our.network.tgcsnet.com is more than two years old. Check with your vendor to find out if a newer version is
available. Installed driver details: 4.8.4.0 - 20090610163426.409397-240
WARNING: Network interface driver file 'c:\windows\system32\drivers\asyncmac.sys' for 'AsyncMac' on server
TGCS025.our.network.tgcsnet.com is more than two years old. Check with your vendor to find out if a newer version is
available. Installed driver details: 6.1.7600.16385 - 20090713201013.139624-240

Number 1 Get-SystemHealth -OutFileLocation "c:\filename.txt"   produced two files and again not the info from the console    see the attached files


Thoughts
test.txt
test.txt.log
0
Will SzymkowskiSenior Solution ArchitectCommented:
Yeah based on what I have tested and additional searching there is really no good way to export this data correctly. I know its not the answer you are looking for but checking the health should be a daily routine and using BPA is the best method IMO.

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

This is very disappointing that cmdlets are missing or do not produce output properly.

This is the second one now that we have not been able to resolve correctly.

I seen other references and they seem to work.

The same with the permissions and credentials not working.

I believe there is something missing here

Or a bug in Exchange 2010 SP3 RU8

Is RU8 the latest?  maybe I should update  first.
0
Will SzymkowskiSenior Solution ArchitectCommented:
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Thanks I thought so. My WSUS server keeps thing up to date,

You saw the console output I only have Hardware related issues.

The default gateway one I am going to move the second nic to another subnet using vlan on my router and switch
my current switch vlan support is not the best planning to upgrade my switch soon.
Even tho it will be on another subnet I still think BPA will complain about two gateway definitions on the server.
When you have two nics on a server when you customize the properties you get a warning message about two gateways.

Would it be BP to have the second nic without a gateway then add a route add command make it persistent so it will always be there

Thoughts?
0
Will SzymkowskiSenior Solution ArchitectCommented:
Would it be BP to have the second nic without a gateway then add a route add command make it persistent so it will always be there

I had mentioned this to you in the last question you closed. It is not good (in any scenario) to have 2 NIC's that have gateways on each of them.

You need to a have a gateway on 1 NIC and use the Route Command to assign static routes to the other.

Also why do you really need to have an automated report for Test-SystemHealth? This command really doesn't need to be run all the time. I do get that you want it emailed to you but really to open up a cmd shell and type in the command does not really take a lot of effort. If you are an Exchange Admin I would think you would be in the Shell at least 50% of the time.

Will.
0
Thomas GrassiSystems AdministratorAuthor Commented:
Will

Thanks for the help on this

After I get thru using the BPA and clearing any issues
I will check to see if the cmdlets that were missing appear if not
will open new case for the permissions issues

thanks

Tom
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.