zoukankan      html  css  js  c++  java
  • SharePoint 2010 PowerShell 系列 之 Create Site

    # Check to ensure Microsoft.SharePoint.PowerShell is loaded
    $Snapin = get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if($Snapin -eq $null){
        Write-host "Loading SharePoint Powershell Snapin"
        Add-PSSnapin "Microsoft.SharePoint.Powershell"
    }
    
    # Get WebApplication
    $WebAppName = "SharePoint - 999"
    $WebApp = Get-SPWebApplication $WebAppName
    if($WebApp -ne $null){
        Write-host $WebApp.Url -foregroundcolor red
        $SiteUrl = $WebApp.Url+"sites/SharePoint"
        $SiteTitle = "Test SharePoint Powershell Create Site"
        $SiteTemplate = "STS#0" # STS#0 is team site
        
        # Check the site
        $targetUrl = Get-SPSite -identity $SiteUrl -regex
        if($targetUrl -ne $null){
            Write-Host "the Site " $SiteTitle " is existing,deleting......"
            Remove-SPSite -Identity $SiteUrl -confirm
        } 
        # create new site
        Write-Host "Creating new site "  $SiteTitle " please waiting......"
        $NewSite = New-SPSite -Url $SiteUrl -OwnerAlias BTV\Administrator -Template $SiteTemplate -Name $SiteTitle
        Write-host "Finish Createed successful" -foregroundcolor green     
    }
    else{
        Write-host "WebApplication " +$WebAppName +" is not existing"
    }

    SiteType 请参考

    学习目录

  • 相关阅读:
    C#处理json实战
    HDU3994(Folyd + 期望概率)
    POJ1270 Following Orders (拓扑排序)
    HDU 3634 City Planning (离散化)
    HDU4762(JAVA大数)
    POJ3026(BFS + prim)
    POJ1679(次小生成树)
    UVA10487(二分)
    ZOJ 2048(Prim 或者 Kruskal)
    FZU 1856 The Troop (JAVA高精度)
  • 原文地址:https://www.cnblogs.com/Fengger/p/2571364.html
Copyright © 2011-2022 走看看