Connecting to ConfigMgr site via PowerShell
Back to ConfigMgr main menu
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
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
No comments:
Post a Comment