2

can you please tell me How to check SharePoint site is working or it is down down using Power Shell.The version for Power Shell required is Version 2.0?

1

You can check if a site is working using this in powershell:

Get-SPWeb -Identity $url | Select-Object -Property Exists -ErrorAction SilentlyContinue

It actually check if it exists but I don't see why it wouldn't work. If you must, just ping the site...

As far as version you can use any, even the 1.0, but keep in my that some features are not available to the earlier versions.

You can check the differences between each version here:

Difference between powershell versions

1

You can use Invoke-WebRequest -Uri https://url | select StatusCode. Parse that for a non-200/300 message (e.g. parse for 500) and perform an action based on the result.

0

here is a function to print all lists of a web. If the web is available it will print all list titles. If you do this once you can use the script below. If you plan to do it periodic I would compare the title of a specific list with a specific value (~assert).

function Print-Lists-OfWeb 
{
    <#   
    .EXAMPLE
        Print-Lists-OfWeb http://mysite
    #>

    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory=$true)][System.String] $webUrl
    )

    $web = Get-SPWeb $webUrl;

    foreach($list in $web.Lists ) 
    {
        Write-Host $list.Title ("Hidden: " + $list.Hidden)       
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.