Ping all the servers into SP farm using powershell script and send email only if any of them failed to ping.

Hi,
i am trying to have such kind of functionality, so that if any servers in sharepoint farm failed then it will send notification email to specific user that server is not able to ping or failed. Right now following script is working but it sending mail either
servers are all running or dead. But i would like to send email only if any of the server failed to ping. what i need to modify following code to work.
Thanks in advanced
#### Provide the computer name in $computername variable 
$ServerName = "localhost","Dc-XX"  
$smtp = "ExchChange" 
$to = "[email protected]
$from = "[email protected]
$sub = " Server Status" 
$body = @" 
##### Script Starts Here ######   
 foreach ($Server in $ServerName) { 
                    if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {  
                        $body += write-output "$Server is alive and Pinging `n"  
                            } else { $body += Write-output "$Server seems dead not pinging `n"  
$body 
send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body  -From $from   

you need to put a check on the send-mailmessage if no ping fails then exit else send the email with message.
also try this script, performing the the same thing but more granular way
http://gallery.technet.microsoft.com/scriptcenter/d0670079-6158-4dc5-a9da-b261c70e4b7d#content
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

Similar Messages

  • I have these black boxes around all the images i add. why are they there and how do i get rid of them?

    i have black boxes around all the images i bring into pages. why are they there and how can i get rid of them?

    Pages rememebers the last setting you used on images.
    So if you had a border on the last image the next one you bring in will have one too.
    To change that select:
    Inspector > Graphic > Stroke > None
    Spend a little time exploring the menus and particularly the Toolbar and Inspectors whcih are in reasonably logical progression from big things down to smaller details and clearly labeled.
    It is also possible that you have show Layout on which outlines objects on th screen so you can see what's what. To change that:
    Menu > View > Hide Layout
    Peter

  • Iphone 3Gs won't update i get an error message that says i am not connected to the internet. i HAVE TRIED ALL THE RECOMENDED TROUBLESHOOTING. ITUNES UPDATE WAS SUCCESSFUL AND I AM NOT HAVING ANY TROUBLE WITH THE ITUNES STORE. SO IT DOESN'T MAKE ANY SENSE

    When I go to sync my iphone 3gs itunes alerts me that an update is available. I check to download an update. I then receive an error message stating that I am not connected to the internet. I am 100% positive that I am connected and before this download I was instructed to update itunes which I did without any problems and restarted my computer. I have tried all of the troubleshooting suggestions. I have no problem syncing or using the itunes store. I just can't get the update. I also have no problems with my iphone connecting to a wireless internet connection. Please Help!!!!!!

    http://support.apple.com/kb/TS3694
    http://support.apple.com/kb/TS3125
    http://support.microsoft.com/kb/299357

  • I just really need to know... After desigining my UX, how do I go about adding the image into ADOBE FLASH BUILDER to script on top of it?

    I just really need to know... After desigining my UX, how do I go about adding the image into ADOBE FLASH BUILDER to script on top of it?
    Any and all advice is welcome.

    Do you have different versions of the graphic novel pages, or is there just one version of the page? If there is one version, can you crop into the page without losing anything important?
    I would guess that there is one version, and that cropping into the page will lose something important. If that's the case, here's how I would handle it:
    Make a stage that is 14:9. The size doesn't matter, but 1400x900 could be a good starting point.
    Put down a background texture that fits well with the look of the other images. Make that fill the 1400x900 stage.
    Place your page graphics so that they are within the center 1200x788 area of the stage.
    Set the stage scalemode to "noBorder".
    You now have a layout that will work on all devices, as narrow as iPad, and as wide as iPhone 5. All without any code. On the widest devices you'll see a bit of your background pattern to the left and right of the page graphic. On the narrowest devices you'll see a bit of background pattern above and below the page graphic. But you won't lose sight of anything important.

  • I have a infopath form and i want to publish this form using powershell script(No central admin usage) and i am using Infopath 2010.

    How to publish infopath form using powershell script in infopath 2010?
    Is any approach for such solution.

    Hi,
    Try below command:
    Uninstall the existing solution (based on the from file name):
    Uninstall-SPInfoPathFormTemplate -Identity Exampleform.xsn
    Install the new solution (based on the from file name):
    Install-SPInfoPathFormTemplate -Path C:\Form.xsn
    Disable feature on site collection level
    Disable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site http://SPSite
    Enable feature on site collection level
    Enable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site "http://SPSite"
    See this blogs for your ref:
    http://rgielen.blogspot.in/2010/11/deploy-infopath-2010-forms-with.html
    http://mysharepointwork.blogspot.in/2010/09/deploy-infopath-forms-with-powershell.html
    Hope it could help
    Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • TS3276 Hi.  Just started using Mac Mail on a macbookpro v10.6.8.  I tried to send a message with two excel (for mac) files attached.  One attached as a file, one inserted all the text into the message body.  Help?

    Just started using my Mac Mail program instead of web mail.  When I went to attach two pdf files, one attached as a file, the other inserted all the text into the body of the email message.  How do I get it to attach both pdf's as files?

    I think you're confusing two different things. If you attached PDF files and one of them displayed the PDF icon in the message window, that means it was more than one page. If you saw what appeared to be the actual document for the other PDF file, that means it's only one page and it's normal for it to display that way.
    However, I seem to recall there may (or should) be a button at the bottom-right of the message window that allows you to display those files as icons, even if they're one page. If not, there's a third-party addition you can use to add that feature:
    http://lokiware.info/Attachment-Tamer

  • Why do I have to log in all the time into iCloud every time in spite of clicking the "keep me logged in" box?

    why do I have to log in all the time into iCloud every time in spite of clicking the "keep me logged in" box?

    It is amazing that Apple does nothing about this.  It used to work before but this function (keep me logged in) stopped working a couple of months ago.  Many people seem to have the same problem but Apple seems unable to solve their own problems...

  • Cannot list all the servers within cluster (on Resin)

    We have 10 Resin servers in the cluster, but when I try to list them I got only 9 of them listed.
    It doesn't list the local server (the one from which the servlet is actually invoked).
    Do you have any other idea how to list all the servers?
    Here is the code I use:
    for (int i = 0; i < clusterList.length; i++) {
         ClusterMXBean cluster = (ClusterMXBean) Jmx.findGlobal(clusterList.getObjectName());
         // --- retrieve all servers within one cluster
         ServerConnectorMXBean[] srunNames = cluster.getServers();
         for (int j = 0; j < srunNames.length; j++) {
              ServerConnectorMXBean server = (ServerConnectorMXBean) Jmx
                        .findGlobal(srunNames[j].getObjectName());
              String host = server.getAddress();
              int port = server.getPort();
              String state = server.getState();
    And here is the MX configuration:
    resin:type=SessionManager,Host=default,WebApp=/
    resin:type=ServerConnector,name=i
    resin:type=ServerConnector,name=h
    resin:type=ServerConnector,name=b
    resin:type=Resin
    resin:type=ServerConnector,name=j
    resin:type=ProxyCache
    resin:type=Host,name=default
    resin:type=ServerConnector,name=c
    resin:type=ServerConnector,name=e
    resin:type=Port,name=192.68.1.50-6802
    resin:type=ServerConnector,name=g
    resin:type=ServerConnector,name=a
    resin:type=ThreadPool
    resin:type=WebApp,Host=default,name=/
    resin:type=WebApp,Host=default,name=/mya
    resin:type=ConnectionPool,Host=default,WebApp=/mya,name=jdbc/mya
    resin:type=ServerConnector,name=f
    resin:type=Cluster,name=cluster1
    resin:type=ServerConnector,name=d
    resin:type=SessionManager,Host=default,WebApp=/mya
    resin:type=Server                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    kus wrote:
    There is a solution but not a very portable one, i.e. you can't use it to get a listing of files from any server that you happen to look at. But here are the steps you need to take:
    1. Use a browser (firefox, opera, etc.) to view the file listing and then view the source.
    2. Duplicate the retrieval of data from the given URL in Java (new URL(...), etc.)
    3. Parse the HTTP response and/or the HTML that the server returns to you to extract what you need.
    Step #3 is the biggest piece of work and the format you need to parse will depend on whatever the remote server hands to you. It's intended for humans, not machines; every server can decide how to format this and it even depends on the server's configuration how this data is presented to you. In any case, it's entirely up to you to make sense of whatever the server happens to throw back at you and if the server happens to present you a nice, picturesque page rather than a listing of files then your completely out of luck.He actually wasn't talking about http at all, so most of this thread has been a wild goose chase.

  • I want to use my ipad to display song lyrics. I have all the lyrics on my computer in Word format and want to know the easiest way to convert them to my ipad and what apps I should use..

    I want to use my ipad to display song lyrics. I have all the lyrics on my computer in Word format and want to know the easiest way to convert them to my ipad and what apps I should use.

    I would just leave them in Word...GR reads many formats very easily.
    If our goal is to work on/edit the files it may be useful to look into something like Pages if you have a Mac, and the Pages for iOS devices so you could use the same word processor on both machines.
    But if you convert the Word to PDF and then use GR you can still edit the files...GR will edit and annotated PDF files rather easily.

  • Found all the Servers that were restart without the maintenance mode were actived ?

    Hi all
    I was wondering if I can find a query about this request:
    - Found all the Servers that were restart without the maintenance mode were actived ?
    It's to make a Report To include in Reporting Services.
    sorry for my English :)
    Thank you very much and have a good day

    Hi, first if the maintenance mode is activated no events are collected, then, as example, in default rules you can see the following
    Collection Rule for Windows Restarted Events that collects eventid=6005
    with eventsourcename=eventlog from System
    log which is enabled by default.
    http://www.microsoft.com/technet/support/ee/transform.aspx?ProdName=Windows+Operating+System&ProdVer=5.2&EvtID=6005&EvtSrc=EventLog&LCID=1033
    So you can check Data warehouse DB for presence such event
    select ComputerName, DateTime from Event.vEvent ev
    inner join Event.vEventDetail evd on ev.eventoriginid = evd.eventoriginid
    inner join Event.vEventParameter evp on ev.eventoriginid = evp.eventoriginid
    inner join vEventLoggingComputer elc on elc.eventloggingcomputerrowid = ev.loggingcomputerrowid
    where eventdisplaynumber = '6005' Order by ComputerName, Datetime
    http://blogs.technet.com/b/kevinholman/archive/2007/10/18/useful-operations-manager-2007-sql-queries.aspx
    So if you see this event it means the server was restarted and the maintenance mode was not activated.
    Also keep in mind that there can be other event ids when computer is restarted, as example see the rule
    Collection Rule for Windows Restart Events (restarted from bugcheck)

  • How to know all the items into a block

    Hello everybody.
    Im working with Forms and Reports 10G.
    A fast question.
    I need to know all the items into a block.
    I know that with the get_block_property first_record and Last_record I can know the first and last item into a record but
    how I can know all the others?
    Thanks in advanced and regards to all.
    Happy Cristmast

    You can the fisrt item in a block by using GET_BLOCK_PROPERTY('BLOCKNAME', FIRST_ITEM);
    then loop over the item
    LOOP
      vcItem:=GET_ITEM_PROPERTY(vcItem, NEXTITEM);
      EXIT WHEN vcItem IS NULL;
    END LOOP;

  • I am using the Adobe Acrobat Reader on a mac and I followed all the directions to copy an image but when I press paste only half of the image appears or it appears as an empty square. What can I do to fix this?

    I am using the Adobe Acrobat Reader on a mac and I followed all the directions to copy an image but when I press paste only half of the image appears or it appears as an empty square. What can I do to fix this?

    Hello,
    I would like to inform you that not all the browsers and online PDF readers support copying text from a PDF. If you have opened the PDF online, please download PDF file to your computer and then open the file in Adobe Reader.
    Please share a screenshot if the issue still persists.
    Regards,
    Nakul

  • HT4436 I have now downloaded all of my CD's to my itunes library and have since only purchased new music using itunes Store.  This itunes library is stored on an old Dell Desktop that I am getting ready to replace with an iMac; how can I move the music? 8

    I have now downloaded all of my CD's to my itunes library and have since only purchased new music using itunes Store.  This itunes library is stored on an old Dell Desktop that I am getting ready to replace with an iMac; how can I move the music? 86GB
    Is the music I downloaded from my CD's already in the iCloud or only the music I purchased on itunes?

    This might help: http://www.macworld.com/article/1146958/move_itunes_windows_mac.html.

  • My ipod classic will sync with my itunes and it shows me all the songs have been downloaded. however when i disconnect it i only have 50 songs present on my ipod. in the settings it still tells me 15 GB is being used up. what do i do?

    my ipod classic will sync with my itunes and it shows me all the songs have been downloaded. however when i disconnect it i only have 50 songs present on my ipod. in the settings it still tells me 15 GB is being used up. i have dowloaded nothing onto it but music. i cant find the rest of my songs on it. what do i do?

    Restore the iPod.
    tt2

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

Maybe you are looking for