fsprojects / FSharp.Management

The FSharp.Management project contains various type providers for the management of the machine.
http://fsprojects.github.io/FSharp.Management/
Other
91 stars 32 forks source link

PowerShell Provider: Invoke-Command executes but no error or results #65

Closed Firgeis closed 8 years ago

Firgeis commented 8 years ago

I'm testing the type provider, even though the target machine registers a login and powershell commands I get no errors or return value (result is None). Removed User/Pass/Machine name but checked the values and seem to be ok

#r "System.Management.Automation.dll"
#r "FSharp.Management.PowerShell.dll"

open FSharp.Management

type Ps = PowerShellProvider<"Microsoft.PowerShell.Commands;Microsoft.PowerShell.Core">

let username = """xxx"""
let (password:string) = """xxx"""
let passlistopt = Ps.``ConvertTo-SecureString``(string = password, asPlainText=true, force=true)
let pass = passlistopt.Value.Head

let pscred = new System.Management.Automation.PSCredential(username, pass)

let host = [|"myMachine.myDomain.com"|]
let script = """{Get-Culture}"""
let scriptBlock = System.Management.Automation.ScriptBlock.Create(script)

let result = Ps.``Invoke-Command``(computerName=host,scriptBlock=scriptBlock, credential=pscred)
sergey-tihon commented 8 years ago

Should be fixed in v0.4.0