Asked by:
PowerShell Remoting on SCCM

Question
-
I have a primary SCCM server - "ABC"
Later i installed SCCM console and PowerShell Module on one more machine - "XYZ"
Issues:
1) when i open SCCM Console on XYZ Server and Click on Top Left Drop Down - Connect Via PowerShell ISE, i see provider machine as "ABC" in the script that is Auto Generated.
2) From My Desktop When I do Invoke-Command on XYZ server and try to Import-Module SCCM and Create SCCM Drive i get Error.
The User Id I am using only has admin permissions on "XYZ" Server. It doesn't have any permissions on "ABC" Server
ERROR I GET
The SMS Provider reported an error.
+ CategoryInfo : OpenError: (:PSDriveInfo) [New-PSDrive], WqlQueryException
+ FullyQualifiedErrorId : Drive,Microsoft.PowerShell.Commands.NewPSDriveCommand
+ PSComputerName : XYZ
Cannot find drive. A drive with the name '' does not exist.
+ CategoryInfo : ObjectNotFound: (:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
+ PSComputerName : XYZ
- Edited by PowerShellLearner Tuesday, March 24, 2020 10:13 AM
Tuesday, March 24, 2020 6:14 AM
All replies
-
Hi,
How did you import the module?
If you are using a share network path in your command, you have to ensure that the user has at least a Read permission on XYZ server on this folder. Make sure also that the user has admin privileges on the SCCM console.
More details:
Regards,
_________________________
Youssef Saad | Blog | LinkedIn | Twitter
Please remember to mark the replies as answer if they help, thank you!
Tuesday, March 24, 2020 7:04 AM -
I first created a new powershell session to XYZ server using New-PSSession Command
Then i Used Invoke-Command -Session $Session -ScriptBlock {Import-Module -Path $PathofModuleonXYZ Server}
The account that i am using has ADmin rights on XYZ server.
Tuesday, March 24, 2020 10:12 AM -
To load the module on a device that has the Configuration Manager console installed in the ISE or VSCODE you could use something like, just change sitecode and siteserver top 2 lines.
Function Get-SMSDRIVE { $Sitecode = 'PS1' $SITESVR = "$env:COMPUTERNAME" $CMModulePath = $Env:SMS_ADMIN_UI_PATH.ToString().SubString(0, $Env:SMS_ADMIN_UI_PATH.Length - 5) ` + '\ConfigurationManager.psd1' Import-Module $CMModulePath -Force Set-Location -Path "$Sitecode`:" } . Get-SMSDRIVE
To use the module on a device that doesn't have the Configuration Manager console installed you can do something like:
$sess = New-PSSession -ComputerName CM01 -ConfigurationName Microsoft.PowerShell32 Invoke-Command -Session $sess -ScriptBlock { Import-module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" Set-Location PS1:\ Get-ChildItem Get-CMApplication -Name 'Microsoft .NET Framework 4.7.2.0.1' | Select-Object -Property LocalizedDisplayName, CI_UniqueID } Remove-PSSession -ComputerName CM01
Richard Knight | Collection Refresh Manager | Automate detection rules for patch \ msp files | Twitter
Tuesday, March 24, 2020 10:48 AM -
-
Hi,
Thanks for posting in TechNet.
Please refer to the following articles:
How to import ConfigMgr powershell cmdlets
PowerShell – Connecting to Configuration Manager
Please also check the permissions. Refer to:
Create CM PSDrive in PowerShell
Thanks for your time.
Best regards,
SimonPlease remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.Wednesday, March 25, 2020 9:26 AM -
Hi,
May we know the current status of the question? If there is any other assistance we can provide, please feel free to let us know, we will do our best to help you.
Thanks and regards,
SimonPlease remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.Monday, March 30, 2020 2:26 AM -
$Session = New-PSSession -ComputerName "XYZ" -Authentication Kerberos -Credential $Cred -ConfigurationName Microsoft.PowerShell32
Invoke-Command -Session $Session -ScriptBlock {
Import-module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
Set-Location PS1:\
}ERROR ::
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
+ CategoryInfo : OpenError: (PS1:PSDriveInfo) [Import-Module], UnauthorizedAccessException
+ FullyQualifiedErrorId : Drive,Microsoft.PowerShell.Commands.ImportModuleCommand
+ PSComputerName : XYZ
Cannot find drive. A drive with the name '' does not exist.
+ CategoryInfo : ObjectNotFound: (PS1:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
+ PSComputerName : XYZ
- Edited by PowerShellLearner Tuesday, March 31, 2020 11:49 AM
Tuesday, March 31, 2020 11:48 AM -
Hi guys,
I just got exactly the same issue. Cause of the issue was, that I was connecting to a ConfigMgr management point via remote PowerShell and from there another connection was needed to the primary site server. This was not possible due to remote PowerShell issues with connection hopping:
Easiest solution: just connect to the primary site server instead of connecting to the management point, solved my issue :-)
All the best,
Fabian
Wednesday, August 26, 2020 1:18 PM