PowerShell is a more powerful tool to manage the System
Center Configuration Manager.
To connect the SCCM using PowerShell, you can use the below
PowerShell script.
When you execute any cmdlets or script by using the PowerShell console, your cmdlets or script will be runs in the primary site server.
Add the below line into the PS Script when you are importing the SCCM module first time on the machine.
New-PSDrive -Name "drive name here" -PSProvider "AdminUI.PS.Provider\CMSite" -Root "The SCCM primary site server
name FQDN" -Description "Primary site description"
You can provide the PSDrive name like "$($SiteCode.Name):\".
<#
.SYNOPSIS
Connect the PowerShell session to the SCCM primary site server.
.DESCRIPTION
This script will help you to connect the PowerShell session to the SCCM primary site server.
.NOTES
=============================================================================================================================================
Created with: Windows PowerShell ISE
Created on: 18, 2015 10:32:24 PM
Created by: Dashrath Chate
Organization: Organization Name
=============================================================================================================================================
#>
Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1)
$SiteCode = Get-PSDrive -PSProvider CMSITE
$SMSProvider=$sitecode.SiteServer
Set-Location "$($SiteCode.Name):\"
No comments:
Post a Comment
Leave your valuable words here for improve better.