Powershell provider - mapping network drive does not work nor produces error output
Closed this issue · 5 comments
ntr commented
I'm trying to map network drive using powershell provider by executing code in interactive:
type PS = PowerShellProvider< "Microsoft.PowerShell.Management;Microsoft.PowerShell.Core" >
PS.``New-PSDrive``(name="M", pSProvider="FileSystem", root="\\127.0.0.1\c$", persist=true)
It fails to create the drive and does not provide any information about the error.
Corresponding powershell creates network drive:
New-PSDrive –Name "M" –PSProvider FileSystem –Root "\\127.0.0.1\c$" -persist
sergey-tihon commented
The reason is that you have used incorrect string
literal for root
parameter.
Use @
symbol to convert it to verbatim string literal => @"\\127.0.0.1\c$"
.
Full source code:
#r "FSharp.Management.PowerShell.dll"
#r "System.Management.Automation.dll"
open FSharp.Management
type PS = PowerShellProvider< "Microsoft.PowerShell.Management;Microsoft.PowerShell.Core" >
PS.``New-PSDrive``(name="M", pSProvider="FileSystem", root= @"\\127.0.0.1\c$", persist=true)
ntr commented
Yes, that helped. But shouldn't the provider report to user what is the problem? Via returned object/exception?
sergey-tihon commented
@ntr you are right, we need to find a way to catch errors and show them to the user
sergey-tihon commented
@kcheick Would you like to improve error reporting in PowerShell
type provider?
sergey-tihon commented
Should be fixed in v0.4.0