SMBShare PSSessionConfoguration Error


I’m trying to create a PS endpoint for the use of the SMBShare module. I create the PSSessionConfigurationFile and register it seccessfully, but when I try to enter a session using this config, I get this error that the C drive doesn’t exist:

Enter-PSSession : One or more errors occurred processing the module 'smbshare' specified in the InitialSessionState object used to create this runspace. See the ErrorRecords property for a 
complete list of errors. The first error was: Cannot find drive. A drive with the name 'C' does not exist.
At line:1 char:1
+ Enter-PSSession -ComputerName igep -ConfigurationName netadapter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Enter-PSSession], RunspaceOpenModuleLoadException
    + FullyQualifiedErrorId : ErrorLoadingModulesOnRunspaceOpen

Pretty interesting.

If you limited the configuration so that it can’t load PSDrives, this can happen. The shell wants to start in a directory, but if it doesn’t have a drive, it can’t. And the SmbShare module in particular may have a dependency on being able to access a drive.

Sessions with no drives are usually only accessible by Invoke-Command, which doesn’t try to create a prompt. Although, again, if SmbShare has a dependency, you will have to satisfy it.

I never thought of it! I’ll try it, thank you!