Hello.
I've been working on a project for almost 6 months.I use powershell via c# in order to control vmm.
I've been having memory issues since the beginning.I don't know what is going on.(up to 2GB in a few minutes)
I have included a very basic forms application which reproduces the problem.
In fact what i'm doing is:
Any ideas please?
A sample project http://www68.zippyshare.com/v/3971803/file.html
I've been working on a project for almost 6 months.I use powershell via c# in order to control vmm.
I've been having memory issues since the beginning.I don't know what is going on.(up to 2GB in a few minutes)
I have included a very basic forms application which reproduces the problem.
In fact what i'm doing is:
for (int x = 0; x < 100; x++) { using (PowerShellInstance = PowerShell.Create()) { StringBuilder sb = new StringBuilder(); //sb.Append("Import-Module virtualmachinemanager;"); sb.AppendFormat(@"$User = ""{0}"" ;", usernamev); sb.AppendFormat(@"$PWord = ConvertTo-SecureString –String ""{0}"" –AsPlainText -Force;", passwordv); sb.Append(@"$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord;"); sb.AppendFormat(@"$vmmConnection=Get-SCVMMServer {0} -UserRoleName 'Administrator' -Credential $Credential;", serveripv); sb.Append(@"$vmmConnection.Disconnect();"); PowerShellInstance.Commands.AddScript(sb.ToString()); var l = PowerShellInstance.Invoke(); } }
Any ideas please?
A sample project http://www68.zippyshare.com/v/3971803/file.html