Status of active 7 roles Web site with PowerShell.

I searched for a way to monitor the site to an active role with PowerShell. I was stuck when you pull into a page request via Invoke-WebRequest and System.Net.WebClient.

Example 1:
$ARSURL = ""https://ars.org " "
$Creds = get-Credential
Invoke-WebRequest - Uri $URL - Credential $Creds
And I get the following error: "Server error: Invoke-WebRequest.
401-Unauthorized: access is denied due to credentials not valid. »

Example 2:
$webclient = new-object System.Net.WebClient
$webclient. Credentials = new System.Net.NetworkCredential ($username, $password, $domain) object
$webpage = $webclient. DownloadString ($url)
And I get the following error: Exception calling 'DownloadString' with '1 ': arguments
"The remote server returned an error: (401) unauthorized."

Any idea on how I can connect on the site of ARS through PowerShell?

Well - I answered a question about ARS 7 without thinking about it - I'm still not there.  This answer applies to the ARS 6.9... Can also be applied to Version 7 - if the page can be called directly.  If not, your mileage may vary.

If you're still with me... I played with it a little too there is more to explore... but here is a style of performing the task.

For me - a quick way to check the availability of a web site of ARS would be to remove the page and display the user ID connected on ARS service and web version + the status of the page.

We maintain 4 distinct groups of servers ARS, and I spend the $ARSURL below three web servers ARS to check that the site is up, and he is currently pointed to the good host ARS service partner.

$ARSURL = "myhost.myplace.com/.../About.ASPX ".

$page = call-WebRequest - Uri $ARSURL -UseDefaultCredentials

($page.allelements | where {$_.tagname - eq "TBODY"}) .innertext

Returns:

Current user: DOMAIN\USERID

Role: ActiveRoles administrator

The Web Interface version: 6.9.0.5483

Administrative service: myhostinGA.myplace.com

Version of Service administration: 6.9.0.5483

Ok

Ok

You can also - if you look at something in the script of automation in a status report - I'd go with the simple $page. StatusCode - or $page. StatusDescription

the HTHML code for a good result is 200... I have only seen two codes is available or not.  If this is not the 'code' returned is 500.  If the page is building / busy - you will get a long wait and a "timeout."

$ARSURL = "myhost.myplace.com/.../About.ASPX ".

$page = call-WebRequest - Uri $ARSURL -UseDefaultCredentials

$page. StatusDescription

Returns

Ok

Tags: Dell Tech

Similar Questions

Maybe you are looking for

  • HP 15n234sl: Notebook without a door to replace HD

    Hi all!I hope someone can help me! I would like to change the HD of my laptop, but I have a problem: my pc doesen't have a door of 'easy' to access (in spite of the RAM). So, how can I do? I have not found a tutorial on the web or any information abo

  • NI 9425 digital input module

    Hi, could someone please advise me on the following: I plan on the use of the module in the series c with a compact RIO 9425 to detect various devices 24V DC signals. Can I just plug the plug of DI to the positive terminal of a 24V + power and the CO

  • HP Pavilion 15 t-n200: HP Pavilion 15 t n200 - ANOTHER problem of flag - DISPLAY messed...

    So, I bought laptops 15 t-n200 of TWO 2 HP Pavilion last year, and here it is the specs: S window 7 Home Premium 64 4th generation Intel® Core™ i5-4200U processor + Intel® HD graphics card diagonal 15.6-inch BrightView HD (1366 x 768) LED backlit 8 G

  • Sapera LT used with CVI

    Is that what someone has successfully used vision of DALSA, Sapera LT, with CVI library? Sapera LT supposedly has a C language interface. I have this poster in the forum of machine vision, but he seems to be more a SW problem (if, indeed, there are p

  • What should I do to protect my computer because I left the Microtech scam people look at my computer via the ammyn Viewer?

    A woman with an Indian accent called saying she was with Microsoft and I had not answered their many urgent emails on my virus in my computer and she called for help.  I can't believe I fell for this point but finally woke up and realized it sounded