I have a script and the spesification of the script is to warm up the iis pool for applications.
So the first user that uses the server will not have to wait all day.
This is a sharepoint 2007 (yes, we are building a new for 2010 / 2013) and the server is a windows server 2007 (yes, we have many 2008 / 2012 servers ).
But for now our Portal is on the above spesifiaction:
#-Running on machine with WSS/MOSS
#-C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN in path
############################################################################
$status = "The script was launced"
$date = get-date
$log = $status + $date
$run = "---------------------------- Script last run: "
$lastrun = $run + $date
Add-content -Path C:\TEMP\pshell_test\log\log_file.txt -Value $log
Add-content -Path C:\TEMP\pshell_test\log\log_file.txt -Value $lastrun
function get-webpage([string]$url,[System.Net.NetworkCredential]$cred=$null)
{
$wc = new-object net.webclient
if($cred -eq $null)
{
$cred = [System.Net.CredentialCache]::DefaultCredentials;
}
$wc.credentials = $cred;
return $wc.DownloadString($url);
}
$cred = [System.Net.CredentialCache]::DefaultCredentials;
#$cred = new-object System.Net.NetworkCredential("username","password","machinename")
[xml]$x=&”C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o enumzoneurls
foreach ($zone in $x.ZoneUrls.Collection) {
[xml]$sites=&”C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe”
-o enumsites -url $zone.Default;
foreach ($site in $sites.Sites.Site) {
write-host $site.Url;
$html=get-webpage -url $site.Url -cred $cred;
}
}
----
But i get an error on the line [xml]$x="C:\Program Files\Common....\....\..."
which says: cannot convert value "system.object.[]" to type "system.xml.xmldocument" .Error: "Unexpected end of file while parsing Name has ocurred "Line 2 position 10