Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

programmatically getting the site collection URL from within the stsadm command

$
0
0

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




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>