Hi there
I have a need to run an stsadm command on 6,000 site collections
I can do this by putting all the Site collections in a Powershell collection and running the script below:
$urls = http://webapp/sites/sitecollection1,http://webapp/sites/sitecollection2"
set-location "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
foreach($url in $urls)
{
stsadm.exe -o gl-propagatecontenttype -url $url -contenttype Document >C:\output.txt 2>&1
}
This works but it's clunky getting all those 6,000+ site collections in a Powershell collection
So I am working on a new script:
set-location "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
$WA = http://webapp
$webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("$WA")
foreach($site in $webapp.sites)
{
stsadm.exe -o gl-propagatecontenttype -url $url -contenttype Document >C:\output.txt 2>&1
}
The problem here is programmatically getting the site collection URL from within the stsadm command - and from within the foreach loop
How do I set the $url variable?
Can anyone help?
Cheers
Jonj