Question about using PowerShell to detect web page availability and then perform alternate action.

I have a specific Windows 7 machine that needs to always display a specific Intranet page.  (it shows an internal status page in kiosk mode).
If this machine every loses connectivity to the web server, unfortunately, the browser shows the typical "web page could not be retrieved" error message and it never recovers.  I need to manually reload the page when the connection is restored.
I'm thinking if it would be possible to write a PowerShell script that checks the connectivity/availability of the Intranet page and if it detects an error, it would launch a browser that points to a local file html file which would say something more professional
and graceful like "site temporarily down for maintenance."  Also, if the PowerShell script could run on a regular interval, when the Intranet page becomes available again, it would close the browser that is showing the maintenance page and start
showing the page with the original Intranet site.
For the Intranet site checking, I was looking at the invoke-webrequest: as the mechanism.
Any guidance would be appreciated as I am new to PowerShell.

With these lines you get the static content of the web page:
$page = new-object net.webclient
$page.UseDefaultCredentials = $True
$Page.DownloadString(“http://www.intranet.local.com/”)
You could first check whether the web server is pingable, then use the lines above to see whether there is a HTML response.
If the web server doesnt respond you could kill the browser process and then open a HTML page stored locally on the Win 7 client:
Invoke-Item .\ErrorPage.html
If the web server responds, kill the browser and restart it showing the Intranet page.
All this run from a scheduled task.

Similar Messages

  • Where can I find information about using the Mozilla Help web pages?

    Such as tips to make searching the help pages faster like adding symbols + or - or " which some internet search systems use.
    There is simply too much information offered for me ( a neurologically disabled person - specifically with working memory difficulties [dyslexia, dyspraxia/DCD] ) and all one can do is write yet another new question - which will probably be a repeat of what has been asked before in a different way and increase the already existing mass of information for the next enquirer to 'wade; through!
    The consequence of not knowing where to look for information, is that I just bumble along and never become as proficient using Firefox (and the web and my computer) as might be possible if I had a really good teacher giving personal one to one guidance matching my knowledge gained so far and skill potential.

    Hi Andrew
    The main introduction to Firefox are these articles
    * https://www.mozilla.org/en-US/firefox/tour/ (it is interactive click to see what happens)
    ** https://www.mozilla.org/en-US/firefox/desktop/
    * [[Get started with Firefox - An overview of the main features]] a long article with plenty of pictures and short video clips
    This is a listing of your previous questions on this forum
    * https://support.mozilla.org/en-US/search?a=1&asked_by=TolknyAgain&sortby=1&w=2
    *Generally for anyone who is signed in to the forum their own questions are seen [https://support.mozilla.org/en-US/questions/all?owner=mine&show=all here] ( [https://support.mozilla.org/en-US/questions/firefox?owner=mine&show=all or] firefox only)
    We do not give general computer help here, but some links that may help you.
    The default search engine used by most versions of Firefox is Google these are some useful help pages
    * [https://support.google.com/websearch/?hl=en#topic=3180167 Welcome to the Search Help Center]
    ** [https://support.google.com/websearch/answer/136861 Search operators] Note a dash maybe used to exclude a word
    **https://support.google.com/websearch/answer/2466433 [ Punctuation and symbols in search]
    * The '''easy way''' just use http://www.google.com/advanced_search
    If you find something useful remember to bookmark it, and that Firefox is good at finding things you have already visited
    * [[How to use bookmarks to save and organize your favorite websites]]
    * [[Awesome Bar - Find your bookmarks, history and tabs when you type in the address bar]]
    Post back in this thread again if you have further questions about Firefox use or our help articles.
    We may not be able to give one to one teaching but we can try to answer questions about Firefox.
    Possibly consider using Firefox on wikipedia and the Khan Academy to learn more yourself.
    This is very simple you have probably already progressed past this but serves as examples
    Some helpful terms
    * [https://simple.wikipedia.org/wiki/Web_browser Browser] <-- clickable link - often blue in colour <br /> More detail https://en.wikipedia.org/wiki/Web_browser
    * [https://simple.wikipedia.org/wiki/Hyperlink Link] <-- link <br />https://en.wikipedia.org/wiki/Hyperlink <-- different article
    * [https://simple.wikipedia.org/wiki/Search_engine Search Engine] <br />https://en.wikipedia.org/wiki/Web_search_engine
    * [https://simple.wikipedia.org/wiki/World_Wide_Web World Wide Web] vs [https://simple.wikipedia.org/wiki/Internet Internet]
    **I will leave it as an exercise for you to look up the ordinary English versions of ''www'' & ''Internet'' in en.wikipedia.org
    ** Note the linked articles are themselves full of links.
    * http://en.wikipedia.org/wiki/Khan_academy -> https://www.khanacademy.org/ <br /> Includes subjects from basic arithmetic to computer programming

  • Question about: Use PowerShell to Toggle the Archive Bit on Files

    Hi Scripting Guys,
    thanks for you favorite scripts. but
    one question: the script abovementioned
    running. But I have to enter a -value
    for each file. If the script is not
    written so that each file checked for the archive
    and then changed? Apparently it
    does not work right with me.
    Here is the script again
    and also a screenshot. Over a short help I
    would be delighted.
    Stephan
    $path = "C:\fso"
    $files = Get-ChildItem -Path $path -Recurse
    $attribute = [io.fileattributes]::archive
    Foreach($file in $files)
     If((Get-ItemProperty -Path $file.fullname).attributes -band $attribute)
       "$file.fullname has the $attribute bit set, removing the bit."
       Set-ItemProperty -Path $file.fullname -Name attributes
       -value ((Get-ItemProperty $file.fullname).attributes -BXOR $attribute)
       "New value of $file.Fullname attributes"
       (Get-ItemProperty -Path $file.fullname).attributes
     ELSE
        Write-host -ForegroundColor blue
        "$file.fullname does not have the $attribute bit set, setting the bit."
        Set-ItemProperty -Path $file.fullname -Name attributes
          -value ((Get-ItemProperty $file.fullname).attributes -BXOR $attribute)
        "New value of $file.Fullname attributes"
       (Get-ItemProperty -Path $file.fullname).attributes
    } #end Foreach

    The attrib command isn't a PowerShell cmdlet:
    http://ss64.com/nt/attrib.html
    If you're asking which line of your script this should replace, the answer is 'the entire thing'.
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • Question about backing up to an external hard drive and then restoring

    I want to back up my iPhone to an external hard drive rather than to CDs/DVDs, and it isn't an option under "Backup." I thought this could be done by consolidating the iTunes library and then copying the entire iTunes folder to the hard drive. But now I've read some things that make me not so sure. Can this be done? And if so, how do I restore everything if need be? I want to have a way to backup/restore in the case of having to reformat the hard drive or if I switch to using another computer. I am using a Windows computer.

    Your iPhone's backup, which is created and maintained by iTunes stores data such as most iPhone settings, email account settings, contact info, SMS messages, notes, recent calls, call favorites, photos available in your iPhone's camera roll (you shouldn't depend on your iPhone's backup alone for these photos, which should be imported by your computer as with any other digital camera), and 3rd party app settings and data created and stored by a 3rd party app.
    It isn't necessary to backup your iPhone's backup. You can manually update your iPhone's backup at any time without syncing, and the same when connecting your iPhone with iTunes on another computer. With your iPhone connected to iTunes and without syncing, control-click on your iPhone and at the menu window that appears, select Back Up.
    Maintaining a backup of your iTunes library is much more important - copying the entire iTunes named folder to an external drive or some other external media used for backup purposes.
    Since the iPhone is designed to be synced with a supported application on your computer for contact info and calendar events, you should maintain a backup of the supported application on your computer for this data. Photos transferred from your computer to your iPhone are not included with your iPhone's backup, so these photos should be included with your computer's backup along with all other important data.
    When syncing an iPhone with iTunes on another computer, only iTunes content on the iPhone will be erased first, not all data on your iPhone such as contact info and calendar events. When selecting photos to be transferred to your iPhone from another computer, all photos available on your iPhone that were transferred from another computer will be erased first. If you don't select to sync contact info and calendar events with a supported application on another computer, contact info and calendar events on your iPhone will not be touched.

  • Web page loads and then disappears after a few seconds

    I have been visiting the More magazine website (www.moremagazine.co.uk ) for some time. However in the last week or so when I click on a link in the e mail I get from them the page loads as usual, stays for a few seconds and then disappears - only a blank page remains.. Even if I refresh I still get a blank page. If I type the URL in manually I just get a blank page immediately.

    Anyone solve this yet?

  • Use html code in web page composer 7.3

    Hi all,
    I have a question about the standard editors of web page composer in 7.3.
    I want to create my own HTML code for the design of the portal page..
    Is it possible to use the code through one of the standard editors?
    At the moment I have created some html pages and store them in the KM content of the portal. Then I make this pages available with the KM Document iViews to use them in the Web Page Composer. The problem now is, that the links to other portal pages doesn't work..
    So is there maybe a possibility to use the html code directly in one of the editors? Or do you know, how you have to define the links to navigate to other portal pages? I tried a href="TBN://..." like the links you get with the Link List Editor, but it doesn't work..
    Thanks in advance for your help!
    Regards,
    Lydia

    Hi,
    now we have the tinyMCE editor, where you can insert and edit html-code. It works fine now for the layout,
    but there are still a few problems with the links..
    In the edit mode there are displayed all km images out of the km. But the images aren't displayed under the portal role, when i publish the page. And all the links like one to a wiki or the TBN links doesn't work, too.
    Can anybody help me further?
    Thanks in advance,
    Lydia

  • Question about Using PAPI Web Service in PowerBuilder 9

    Hi, all.
    I Have a simple question about using papiws in power builder 9.
    In pb9, I created a new Web Service Proxy Wizard and I input a url for papiws(ex. http://seraphpernote:7001/papiws/PapiWebService) and click next.
    But I couldn't get any Service List.
    In Eclipse, I used this url for using papiws well.
    Does anybody know about this case??
    help me plz.

    IIRC you must activate PAPI-WS for the engine. In Studio you do it by right-clicking on the project, then "engine preferences". In enterprise/standalone you must activate PAPI-WS in the Admin Center.

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Javascript not working in Firefox 32.0 - about:config says enabled - but web pages say different

    For example maps not loading on hotel pages. Various other errors appear now on web pages saying ' You must have JavaScript enabled'. I'm not a computer person, but I can see from about:config says its enabled -
    javascript.enabled;true
    Any other suggestions???

    You can open the Web Console (Firefox/Tools > Web Developer).
    Check on the Network tab if any content is blocked and has a file size 0 (zero).
    *https://developer.mozilla.org/Tools/Web_Console
    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox > Preferences > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox > Preferences > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • I used to have a web page in mobile me and now is closed.  How can I get my webpage data back?

    I used to have a web page in mobile me and now is closed.  How can I get my webpage data back?

    Your web pages on MobileMe have been deleted. If you were using iWeb you wouldn't have been able to open them anyway.
    As long as you have the iWeb 'Domain' file in your user Library, or whatever the program you are using stores the information in, on your Mac you can publish to another hosting service - there are plenty to choose from. More information here:
    http://rfwilmut.net/missing2

  • Question about using Apple Mail with Verizon

    Not sure if this is an Apple or Verizon question, but leaning toward the latter so here it is...
    On my MacBook Pro, running OS 10.8.3, I have several accounts. Each has its own Verizon username e.g. [email protected], [email protected] etc. Everything had been working fine but last night I had an issue sending email from, say, the username1 account. I went to the username account to test it out and it worked fine - I sent an email to username1 in Mail and username1 had no problem receiving it. But username1 couldn't send email - it gave an error message about the outgoing server, asking me if I wanted to try another one.
    Now the odd thing is that the outgoing server name was (and has always been) exactly the same for username1 and username. But when I selected outgoing.verizon.net:username1 instead of the usual one, it was able to send email. I'm not sure why that other server name was listed as an option, but glad that it was there.
    So my question is why would two accounts on the same computer have to use two different Verizon outgoing mail servers in order to send email?
    Thanks.
    P.S. I should mention that, based on input from this forum, I ignored Verizon's "urgent" email from back in March about changing mail settings.

    abcdefghij wrote:
    Not sure if this is an Apple or Verizon question ... last night I had an issue sending email ... why would two accounts on the same computer have to use two different Verizon outgoing mail servers in order to send email? ...
    P.S. ... based on input from this forum, I ignored Verizon's "urgent" email from back in March about changing mail settings.
    There's input, and then there's input.
    By this time you should be using only the recommended settings across all your devices and platforms.  As far as I can determine, all devices, operating systems, mail clients, etc., have been successfully configured using the new recommended settings.  There are indeed individuals who are still finding issues, but the general consensus among experienced users seems to be that the issues reported are related to individual settings and devices, and do not stem from the server side.
    BTW I don't at all mean to suggest that a particular user is anything less than capable.  I'm just stating what I believe is the situation today.

  • I use to be able to rotate my iPhone and change the view of an image, Web page, email, and so on, from portrait to landscape, but after update, I cannot. I can only view in portrait mode. Anybody know what's up with that?

    I use to be able to rotate my iPhone and change the view of an image, Web page, email, and so on, from portrait to landscape, but after update, I cannot. I can only view in portrait mode. Anybody know what’s up with that?

    You need to do the basic troubleshooting steps described in the User Guide, Appendix B.
    Restart phone
    Reset phone
    Restore in iTunes using a backup
    Restore in iTunes as new, without using a backup
    If restoring as new doesn't help, there is a hardware failure in the phone that needs evaluation by Apple.

  • I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher

    I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher #1 iPad to its AppleTV without effecting/projecting onto the adjacent teachers #2 classroom AppleTV?

    Not as such.
    Give the AppleTV units unique names and also enable Airplay password in settings with unique passwords for each teacher.
    AC

  • Why use Dreamweaver for create web pages

    Hi I am new in Dreamweaver and I want to know why use Dreamweaver for create web pages?

    Twitter
    http://twitter.com/altweb
    Blog
    http://alt-web.blogspot.com/
    Site
    http://alt-web.com/

  • Question about using new battery in old Powerbook

    I have a pre-intel Powerbook G4, and the battery is pretty much toast (lasts about 15 minutes now). I have ordered a new battery for it, and I have this question about using it:
    Am I smarter to keep the new strong battery out of the PB most days (as I usually work with it plugged in at home) and just pop it in when I know I will be out surfing on batteries? Or is it just as good living in my laptop 24/7 and only occasionally being called upon to do its job?
    Current bad Battery Information below:
    Battery Installed: Yes
    First low level warning: No
    Full Charge Capacity (mAh): 1144
    Remaining Capacity (mAh): 1115
    Amperage (mA): 0
    Voltage (mV): 12387
    Cycle Count: 281
    thanks folks, Shereen

    Hi, Shereen. Every Powerbook battery wants to be used — drained and then recharged — at least every couple of weeks. If you've always used your Powerbook on AC power nearly all the time, and not followed that pattern of discharging and recharging the battery every week or two, it's possible that your use habits have shortened the lifespan and prematurely diminished the capacity of your old battery. Of course it's also possible that your battery is merely old, as a battery's capacity also diminishes with age regardless of how it's used. You didn't say how old the battery is in years, so this may or may not be an issue. I mention it only because it can be an issue.
    For general information on handling a battery for the longest possible lifespan, see this article. My advice on the basis of that article and long experience reading these forums is that it would be OK to do as you propose, but I doubt that you'd derive any significant benefit from it. You would still want to be sure of putting the new battery through a charge/discharge cycle every week or two, even if you didn't have a reason to use the Powerbook away from home or your desk, because sitting unused outside the computer is just as bad for a battery as sitting unused inside it. And you should never remove the battery from your computer when it's completely or almost completely discharged and let it sit that way any longer than a day or two.
    Message was edited by: eww

Maybe you are looking for