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

    学习目录

    文字描述比较不容易说清楚,直接贴代码吧

    # 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"
    }
    
    Write-Host "Starting create WebApplication"
    $WebAppName = "SharePoint - 999"
    $WebAppPort = 999
    $WebAppPool = "SharePoint - 999"
    $WebAppDBName = "WSS_Content_999"
    
    #Delete any existing Webapplication by name
    $targetUrl = Get-SPWebApplication $WebAppName
    if($targetUrl -ne $null){
        Write-host "Deleting existing webapplication:" $WebAppName
        Remove-SPWebApplication $WebAppName -confirm -DeleteIISSite -removeContentDatabase
        Write-host "Deleted Site and ContentDatabase successful." -foregroundcolor red
    }
    
    
    Write-Host "Please waiting......" -foregroundcolor green
    $WebApp = New-SPWebApplication -Name $WebAppName -Port $WebAppPort -ApplicationPool $WebAppPool -DatabaseName $WebAppDBName -ApplicationPoolAccount (get-SPManagedAccount "T\Administrator")
    Write-Host "WebApplication Created successfully"
    
    #display WebApplication Info
    Write-Host
    Write-Host "------------------------------" -foregroundcolor Green
    Write-Host "Name:" $WebApp.Name -foregroundcolor Yellow
    Write-Host "URL:" $WebApp.Url   -foregroundcolor Yellow
    Write-Host "------------------------------" -foregroundcolor Green

    在每次处理的时,都要添加 Microsoft.SharePoint.PowerShell,否则会出错的。

  • 相关阅读:
    HTML5文件上传前本地预览
    sql(2) DISTINCT
    sql (1)
    delphi 第4课
    delphi 第3课
    Delphi 第2课
    delphi 用户可以点击格式修改进行模板修改
    delphi 流程单打印
    Delphi 第一课
    【BZOJ4530】[Bjoi2014]大融合 LCT维护子树信息
  • 原文地址:https://www.cnblogs.com/Fengger/p/2571360.html
Copyright © 2011-2022 走看看