powershell 此脚本为安全站点创建单元站点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 此脚本为安全站点创建单元站点相关的知识,希望对你有一定的参考价值。

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$web = get-spweb http://portal.opwftg.com/sites/OPWSS
$template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Title -eq 'OPW Safety - Cell Updated'}

$Cell1 = '10 Cell Assembly'
$Cell2 = '71SO'
$Cell3 = 'Admin'
$Cell4 = 'Assembly'
$Cell5 = 'CNC'
$Cell6 = 'Engineering'
$Cell7 = 'Extrusion'
$Cell8 = 'Fibrelite'
$Cell9 = 'Janitor Service'
$Cell10 = 'Maintenance'
$Cell11 = 'Metfab'
$Cell12 = 'Mfg. Engineering- Machine Shop & Welding'
$Cell13 = 'QC'
$Cell14 = 'Roto'
$Cell15 = 'Shipping/Receiving'
$Cell16 = 'Spill Bucket'

$TargetWebURL1 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell1
	$TargetWebURL2 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell2
	$TargetWebURL4 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell4
	$TargetWebURL5 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell5
	$TargetWebURL6 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell6
	$TargetWebURL7 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell7
	$TargetWebURL8 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell8
	$TargetWebURL9 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell9
	$TargetWebURL10 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell10
	$TargetWebURL11 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell11
	$TargetWebURL12 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell12
	$TargetWebURL13 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell13
	$TargetWebURL14 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell14
	$TargetWebURL15 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell15
	$TargetWebURL16 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/" + $Cell16
	
$newWeb = New-SPWeb -Url $TargetWebURL1 -Name $Cell1
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL2 -Name $Cell2
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL4 -Name $Cell4
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL5 -Name $Cell5
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL6 -Name $Cell6
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL7 -Name $Cell7
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL8 -Name $Cell8
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL9 -Name $Cell9
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL10 -Name $Cell10
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL11 -Name $Cell11
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL12 -Name $Cell12
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL13 -Name $Cell13
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL14 -Name $Cell14
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL15 -Name $Cell15
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL16 -Name $Cell16
$newWeb.ApplyWebTemplate($template)
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$web = get-spweb http://portal.opwftg.com/sites/OPWSS
$template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Title -eq 'OPW Safety - Cell Updated'}

$Cell1 = 'Loader Cell'
$Cell2 = 'Swivel Cell'
$Cell4 = 'Kamvalok Cell'
$Cell5 = 'Sure Seal Cell'
$Cell6 = 'Support Cell'
$Cell7 = 'Epsilon Cell'
$Cell8 = 'Iso-Ring Cell'
$Cell9 = 'Visiflo Cell'

$TargetWebURL1 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell1
	$TargetWebURL2 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell2
	$TargetWebURL4 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell4
	$TargetWebURL5 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell5
	$TargetWebURL6 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell6
	$TargetWebURL7 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell7
	$TargetWebURL8 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell8
	$TargetWebURL9 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells/" + $Cell9
	
$newWeb = New-SPWeb -Url $TargetWebURL1 -Name $Cell1
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL2 -Name $Cell2
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL4 -Name $Cell4
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL5 -Name $Cell5
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL6 -Name $Cell6
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL7 -Name $Cell7
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL8 -Name $Cell8
$newWeb.ApplyWebTemplate($template)

$newWeb = New-SPWeb -Url $TargetWebURL9 -Name $Cell9
$newWeb.ApplyWebTemplate($template)

以上是关于powershell 此脚本为安全站点创建单元站点的主要内容,如果未能解决你的问题,请参考以下文章

在 PowerShell 中显示所有站点和绑定

用powershell脚本实现zabbix LLD 监控IIS站点

powershell SharePoint PowerShell脚本,用于显示站点的用户和用户角色

powershell Powershell脚本,用于获取SharePoint站点中特定列表的所有详细信息

如何改变PowerShell启动的默认目录

powershell 使用powershell创建一个健全的Intranet子站点