Wednesday, September 21, 2011

WarmUp Script

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue 
   foreach ($webApp in get-SPWebApplication) 
    {     
        foreach ($site in $webApp.Sites) 
        { 
            foreach ($web in get-SPWeb -site $site) 
            { 
                $request = [System.Net.WebRequest]::Create($web.URL) 
                $request.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials 
                $request.proxy = [System.Net.WebRequest]::DefaultWebProxy 
                $request.ContentType = "application/x-www-form-urlencoded" 
                $request.Method = "GET" 
        try{ 
                    $request.GetResponse().StatusCode 
            WRITE-HOST $request.GetResponse().StatusCode 
                } 
                catch [Net.WebException]{ 
                    $WebExceptionMessage = $_.Exception.Message 
                    WRITE-HOST "Folgender Fehler ist aufgetreten: " + $WebExceptionMessage 
                } 
            } 
        } 
    }

No comments:

Post a Comment