snyperj
asked on
Monitoring Server login status
We have a 10 server XenApp 6.5 farm. Often during the day we have to lock a server out (prohibit logins) for various reasons. Our probelm is - we are forgetful and do not always rememeber to renable logins afterward. Is there any way we can set up some type of email alert to show us all 10 server login statuses each morning? Thinking probably not but thought I would inquire.
ASKER
This sounds great, but I am not sure how to customize it for my info?
Can you help?
Lets say I have two three servers and their names are:
XenApp65-XA01, XenApp65-XA02, XenApp65-XA03
How do I enter them?
I tried:
but that causes power shell to error with:
Also, we use Exchange for Mail, am I just entering the mail server name here:
Thanks
Can you help?
Lets say I have two three servers and their names are:
XenApp65-XA01, XenApp65-XA02, XenApp65-XA03
How do I enter them?
I tried:
$ServerStatus = get-XenApp65-XA01| select-object -property ServerName,LogonsEnabled
but that causes power shell to error with:
get-XenApp65-XA01 : The term 'get-XenApp65-XA01' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
Also, we use Exchange for Mail, am I just entering the mail server name here:
$SMTPServer = 'mailserver@domain.tld'
Thanks
with PS command "get-xaserver" you get a list of all XenApp Servers and their configuration.
(try it directly within PS)
but with the script i get the server-names but without Logon-state.
(try it directly within PS)
but with the script i get the server-names but without Logon-state.
You need to add the citrix snapin first
add-pssnapin -name citrix*
Coralon
add-pssnapin -name citrix*
Coralon
ASKER
Almost there.... I can get the results of the servers in the powershell window, now I just need to get the email to send. The script keeps telling me that no smtp server is entered, but I have entered the info for our exchange server, which is also what we have entered for the smtp values in our local scan-to-email devices, so I know it is correct. WHat am I missing?
ee-upload.JPG
ee-upload.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am using 2.0
I modified the script as shown in screen 1. I get the email now, but the body just says:
"Current server status as of 06/23/2015 18:03:34\r\n " and that is is...
I cant get the server statuses to show in the body of the email?
If I run
What do I need to modify to get them into the email body?
Thanks
powershell-2.jpg
I modified the script as shown in screen 1. I get the email now, but the body just says:
"Current server status as of 06/23/2015 18:03:34\r\n " and that is is...
I cant get the server statuses to show in the body of the email?
If I run
get-xaserver | select-object -property ServerName,LogonsEnabled
in powershell, it DOES show them in the powershell window.... What do I need to modify to get them into the email body?
Thanks
powershell-2.jpg
ASKER
Thanks
In your .net command all you do is set the smtp body switch to powershell command..
Taking the example from article..
$EmailFrom = "test@cscncoc.com"
$EmailTo = "bjackson@csncoc.com"
$Subject = "Test mail Subject"
$Body = Get-XAServer | select-object -property ServerName,LogonsEnabled | format-table
$SMTPServer = "AFSBS2K11"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpS erver, 25)
$SMTPClient.Send($EmailFro m, $EmailTo, $Subject, $Body)
Coralon
Taking the example from article..
$EmailFrom = "test@cscncoc.com"
$EmailTo = "bjackson@csncoc.com"
$Subject = "Test mail Subject"
$Body = Get-XAServer | select-object -property ServerName,LogonsEnabled | format-table
$SMTPServer = "AFSBS2K11"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpS
$SMTPClient.Send($EmailFro
Coralon
1st upgrade to powershell v3 (minimum)
Open in new window
Then just schedule the task to run every morning.
You could even add a line to re-enable the logons:
Open in new window
Coralon