Back to ConfigMgr & PowerShell menu
There are two ways to connect to your Configuration Manager site via PowerShell.
Method 1: Using the Configuration Manager console
See the blue tab in the top left corner of the console. Click on the down arrow to reveal the menu. Select "Connect via Windows PowerShell".
It takes a few moments but PowerShell loads. See your Site Code in the command prompt.
Type the cmdlet get-cmsite for information about your site.
Method 2: Manually through PowerShell console
All Windows PowerShell cmdlets are coded and stored in a module. The modules for Windows are available by default in your Windows PowerShell window and you can add more modules. You add modules to your Windows PowerShell session by importing them using the Import-Module cmdlet.
This is the ConfigMgr module and can be found C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin
Open PowerShell as Administrator (Note that we need the x86 version - the ConfigMgr Admin Console is a 32-bit application) and navigate to that path.
Enter the cmdlet import-module .\ConfigurationManager.psd1 and press enter
Now all the ConfigMgr cmdlets are available
Connect to your site by typing the command
CD P01: (where P01 is your Site Code)
Try get-cmsite again
Hi Gerry,
ReplyDeleteI have a odd issue. When I click on "Connect via Windows PowerShell" within the console I get an error says "Configuration manager cmdlets cannot be run because PowerShell 3.0 is not installed, install 3.0 and try again". I'm running the latest version of SCCM 2012 R2 CU1, 5.0.7958.1203. Any idea how I can rectify this issue.
Thanks,
Paul
Unless your OS is Windows Server 2012 you will not have this version of PowerShell. Download it here
Deletehttp://www.microsoft.com/en-ie/download/details.aspx?id=34595
Figured it out Gerry. It was actually the WMF version 4.0. As soon as I installed that everything worked like a champ.
DeleteThanks,
Paul