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,否则会出错的。

  • 相关阅读:
    统计一段文字中出现频率最高的10个单词(c语言)
    java之过滤器Filter (应用场景)
    java之过滤器Filter
    Spring AOP
    清华大学iCenter区块链公开课 第二节
    学习区块链 第一节 精通比特币
    使用Shiro登录成功后,跳转到之前访问的页面实现
    windows下系统移植到linux下出现的问题
    mysql分页查询
    安卓开发随笔
  • 原文地址:https://www.cnblogs.com/Fengger/p/2571360.html
Copyright © 2011-2022 走看看