SCCM Boundaries Import Export
Merhaba, aşağıdaki ps leri kullanarak sccm boundaires gruplarını import export edebilirsini.
Import
# .NOTES
# ===========================================================================
# Created on: 4/10/2017
# Modified on: 4/21/2017
# Created by: Timmy Andersson
# Twitter: @TimmyITdotcom
# Blog: www.timmyit.com
# ===========================================================================
# .DESCRIPTION
# Import Subnet an IPRange Boundries to CSV files. This script needs to run on the siteserver to work.
# Specify source path with the parameter -SourcePath
[CmdletBinding(DefaultParameterSetName = 'SourcePath')]
param
(
[Parameter(Mandatory = $true,
Position = 1)]
$SourcePath
)
Begin{
$SiteCodeObjs = Get-WmiObject -Namespace "root\SMS" -Class SMS_ProviderLocation -ComputerName $env:COMPUTERNAME -ErrorAction Stop
foreach ($SiteCodeObj in $SiteCodeObjs)
{
if ($SiteCodeObj.ProviderForLocalSite -eq $true)
{
$SiteCode = $SiteCodeObj.SiteCode
}
}
$SitePath = $SiteCode + ":"
Import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0, $Env:SMS_ADMIN_UI_PATH.Length - 5) + '\ConfigurationManager.psd1')
}
Process
{
$Subnets = (Import-csv "$SourcePath\BoundariesIPSubnet.csv")
$IPRanges = (Import-csv "$SourcePath\BoundariesIPRange.csv" )
Set-Location $SitePath
If ($Subnets -ne $null)
{
Foreach ($Subnet in $Subnets)
{
New-CMBoundary -Type IPSubnet -Value "$($Subnet.Value)" -Name "$($Subnet.Key)"
}
}
If ($IPRanges -ne $null)
{
Foreach ($IPRange in $IPRanges)
{
New-CMBoundary -Type IPRange -Value "$($IPRange.Value)" -Name "$($IPRange.Key)"
}
}
}
Export
#.NOTES
#===========================================================================
#Created on: 4/10/2017
#Modified on: 4/21/2017
#Created by: Timmy Andersson
#Twitter: @TimmyITdotcom
#Blog: www.timmyit.com
#===========================================================================
#.DESCRIPTION
#Export Subnet an IPRange Boundaries to CSV files. This script needs to run on the siteserver to work.
#Specify Destination path with the parameter $DestinationPath
[CmdletBinding(DefaultParameterSetName = 'DestinationPath')]
param
(
[Parameter(Mandatory = $true,
Position = 1)]
$DestinationPath
)
Begin{
$SiteCodeObjs = Get-WmiObject -Namespace "root\SMS" -Class SMS_ProviderLocation -ComputerName $env:COMPUTERNAME -ErrorAction Stop
foreach ($SiteCodeObj in $SiteCodeObjs)
{
if ($SiteCodeObj.ProviderForLocalSite -eq $true)
{
$SiteCode = $SiteCodeObj.SiteCode
}
}
$SitePath = $SiteCode + ":"
Import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0, $Env:SMS_ADMIN_UI_PATH.Length - 5) + '\ConfigurationManager.psd1')
}
PROCESS
{
Set-Location $SitePath
$BoundriesSubnet = (Get-CMBoundary -BoundaryName * | Where-Object {$_.BoundaryType -like "0"})
$BoundriesRange = (Get-CMBoundary -BoundaryName * | Where-Object {$_.BoundaryType -like "3"})
$ErrorActionPreference = 'Continue'
$IPrange = $null
$IPrange = @{}
$IPSubnet = $null
$IPSubnet = @{}
If ($BoundriesSubnet.count -gt "0")
{
foreach ($Boundry in $BoundriesSubnet)
{
$IPrange.Add($($Boundry.DisplayName),$($Boundry.Value))
}
$IPrange.GetEnumerator() | export-csv "$DestinationPath\BoundariesIPSubnet.csv" -NoTypeInformation -Encoding Unicode
}
If ($BoundriesRange.count -gt "0")
{
foreach ($Boundry in $BoundriesRange)
{
$IPSubnet.Add($($Boundry.DisplayName),$($Boundry.Value))
}
$IPSubnet.GetEnumerator() | export-csv "$DestinationPath\BoundariesIPRange.csv" -NoTypeInformation -Encoding Unicode
}
}
END
{
Invoke-Item $DestinationPath
}
Post Views: 114
Son Yazılar
Arşivler
Kategoriler
Son yorumlar
- RDS “We can’t sign into your account”, Temp Profil Sorunu ve Çözümü için Mehmet Sait YILMAZ
- RDS “We can’t sign into your account”, Temp Profil Sorunu ve Çözümü için Can Karapınar