New-PSDrive is not working Powershell Web Access. RRS feed

  • Question

  • I am trying to map the network drive while executing the script from Powershell Web Access but getting the below error.

    $servername is valid name and the script is working fine on poweshell ISE.  Please help

    New-PSDrive -Name "r" -PSProvider FileSystem -Root "\\$servername\c$\ ...

      + CategoryInfo          : InvalidOperation: (r:PSDriveInfo) [New-PSDrive], Win32Exception
    + FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand

    Wednesday, August 29, 2018 7:44 AM

All replies

  • That is correct.  You cannot do that.


    Wednesday, August 29, 2018 8:17 AM
  • Is there any reason behind it ?
    Wednesday, August 29, 2018 11:19 AM
  • try net use

    net use /?

    Regards kvprasoon

    Wednesday, August 29, 2018 3:54 PM
  • Is there any reason behind it ?

    PSWA can block many commands. You are not running a remote session but are accessing a PS session run under a web server. Many commands that alter the environment won't work,

    I suggest reading the documentation on PSWA and how it is deployed to learn how it works.


    Wednesday, August 29, 2018 4:45 PM