Link to home
Start Free TrialLog in
Avatar of Member_2_6492660_1
Member_2_6492660_1Flag for United States of America

asked on

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.
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

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.
Avatar of Member_2_6492660_1

ASKER

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
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.
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?
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.
User generated image
If you have appropriate permissions all you should have to do is run
Test-SystemHealth

Thats it.

Will.
Will what command can I use to check to see if this account has the correct permissions?
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.
Will

Great

Will check this out and post back later.
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?
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.
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
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
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.
Will

Yes I get all the information displayed on the screen.
Will

I found this on here
https://www.experts-exchange.com/questions/23549396/Running-test-systemhealth-out-File-C-smtptest-txt-returns-me-a-blank-file.html

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


I tried that still only output to the screen


Thoughts
Did the command work to the screen?

So this is just an issue going to a file?

Will.
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
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
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.
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?
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.
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