I have an powershell commando that pulls all my machines of xenapp 7.6 that are registered.
But i want my script to show me output when an machine is unregistered. Can any one help me out with the if and else statement.
This is for registered machines:
Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'Registered' }
Th is for Unregistered servers:
Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'UnRegistered' }
Output is like this:
MachineName
RegistrationState
-----------
-----------------
XXX\wsgrswxa01
Registered
XXX\wsgrswxa02
Registered
XXX\wsgrswxa03
Registered
I tried a little bit with if and else statement. But i don't know how to do it.
(example):
if(?) { echo OK status All XenApp machines or OK exit 0 #Return OK status } else { echo CRITICAL status These Machines(xxxx,xxxx) are Unregistered exit 2 #returns critical status }
Can anyone help me out?