0

I have a custom list where users submit there request for new site, which stores, information such as Site Name, Site url, template type, Size of the site, Site Owners etc.

Can I use powershell script to capture that data and provision sites based off that?

If that can be done, can you please lead me to the right direction on where to start? I am a novice Powershell User and SharePoint Administrator.

4
  • How does a user know the size of the site before a site is provisioned? Is this custom list only used for requesting new sites, or does it also satisfy some other business requirement? Commented Sep 24, 2014 at 16:08
  • We have Quota template set up for the sites for diffrent site types in central admin. I have a Choice Column Set up for users to select three diffrent sizes in the list, which tallies up with the quota size i have available. Commented Sep 24, 2014 at 16:18
  • I don't think you can enforce a disk quota on a website (SPWeb) as it's a setting you set on a site collection (SPSite). Please look here as a reference. Commented Sep 24, 2014 at 16:32
  • We have been doing that for some time now using central admin site creation page. Question is can this be done using powershell? Commented Sep 24, 2014 at 17:26

1 Answer 1

0

To read the items from list :

$sourceWebURL = "http://sharepointsite"
$sourceListName = "mylist"

$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]
$spSourceItems = $spSourceList.GetItems()

$spSourceItems | ForEach-Object {
    Write-Host $_['ID']
    Write-Host $_['Title']
}

To create Site with:

New-SPWeb http://somesite/subweb1 -Template "STS#0"

http://technet.microsoft.com/en-us/library/ff607579(v=office.15).aspx

http://www.bluedoglimited.com/SharePointThoughts/Lists/Posts/Post.aspx?ID=340

3
  • $_["Column Name"] will work for a lot of the fields, but some (like Choice or User or Group) fields will require a little more. Here's a link to help out with that. Commented Sep 24, 2014 at 16:25
  • can i pass $sourceWebURL inside -url property of New-Spweb -url $sourceWebURL as such Commented Sep 25, 2014 at 21:05
  • Yes you can use variables.
    – Aanchal
    Commented Sep 26, 2014 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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