Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

NetworkLoadBalancingCluster module not working from .net code

$
0
0

Hello to everyone. 

I'm trying to call cmdlets from NetworkLoadBalancing from .net code but for some reason it does not work.

Code snippet 1:

InitialSesstionState iss = InitialSesstionState.CreateDefault();

iss.ImportPSModule(new string[]{@"C:\Windows\System32\WindowsPowerShell\v1.0\Modules\NetworkLoadBalancingClusters\NetworkLoadBalancingClusters.psd1"});

Runspace runspace = RunspaceFactore.Create(iss);

runspace.Open();

...

Within runspace there is an FileNotFoundException. For some other module this code snippet works.

I also tried with this code snippet 2:

PowerShell myPowerShell = PowerShell.Create();

myPowerShell.AddCommand("Import-Module").AddArgument("NetworkLoadBalancingClusters");

Collection<PSObject> results = myPowerShell.Invoke();

...

Can You please help me with this?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>