Hello, SCVMM2019 is compliance ?
I try connect, and I have this issue :
[6/24/2021 5:18:01 PM] ERROR: HostedSolution GetSwitches
System.Management.Automation.CmdletInvocationException: The following error occurred while loading the extended type data file: , C:\Program Files\Microsoft System Center\Virtual Machine Manager\bin\virtualmachinemanager.types.ps1xml(163) : Erreur : Type [Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.VMConverter] introuvable.
, C:\Program Files\Microsoft System Center\Virtual Machine Manager\bin\virtualmachinemanager.types.ps1xml(62) : Erreur : Type [Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.TemplateConverter] introuvable.
---> System.Management.Automation.RuntimeException: The following error occurred while loading the extended type data file: , C:\Program Files\Microsoft System Center\Virtual Machine Manager\bin\virtualmachinemanager.types.ps1xml(163) : Erreur : Type [Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.VMConverter] introuvable.
, C:\Program Files\Microsoft System Center\Virtual Machine Manager\bin\virtualmachinemanager.types.ps1xml(62) : Erreur : Type [Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.TemplateConverter] introuvable.
at System.Management.Automation.Runspaces.InitialSessionState.ThrowTypeOrFormatErrors(String resourceString, String errorMsg, String errorId)
at System.Management.Automation.Runspaces.InitialSessionState.UpdateTypes(ExecutionContext context, Boolean updateOnly)
at System.Management.Automation.Runspaces.InitialSessionState.Bind_UpdateTypes(ExecutionContext context, Boolean updateOnly)
at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly, PSModuleInfo module, Boolean noClobber, Boolean local)
at System.Management.Automation.Runspaces.InitialSessionState.Bind(ExecutionContext context, Boolean updateOnly)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at System.Management.Automation.Runspaces.InitialSessionState.ProcessImportModule(Runspace initializedRunspace, String name, PSModuleInfo moduleInfoToLoad, String path, HashSet`1 publicCommands)
at System.Management.Automation.Runspaces.InitialSessionState.ProcessImportModule(Runspace initializedRunspace, IEnumerable moduleList, String path, HashSet`1 publicCommands, HashSet`1 unresolvedCmdsToExpose)
at System.Management.Automation.Runspaces.InitialSessionState.BindRunspace(Runspace initializedRunspace, PSTraceSource runspaceInitTracer)
at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
at SolidCP.Providers.Virtualization.PowerShellManager.OpenRunspace()
at SolidCP.Providers.Virtualization.HyperVvmm.get_PowerShell()
at SolidCP.Providers.Virtualization.HyperVvmm.GetSwitches(String computerName, String type)
Hello, nobody ?
I am going completely crazy.
In order to debug I do tests of powershell command to SCVMM.
In order to simplify the test with IIS, I create a powershell session with authentication in order to be certain of the user.
Even in this case VMM refuses the connection whereas with a console I have no problem.
Powershell / VMM must identify something other than login and block when it comes from IIS.
Sample on IIS :
protected void Page_Load(object sender, EventArgs e) { Runspace runspace = RunspaceFactory.CreateRunspace(); runspace.Open(); Pipeline pipeline = runspace.CreatePipeline(); string scripttext = "$secpasswd = ConvertTo-SecureString 'password' -AsPlainText –Force"; string scripttext1 = @"$mycreds = New-object -typename System.Management.Automation.PSCredential('login',$secpasswd)"; string scripttext2 = "$s = New-PSSession -ComputerName scvmm -Credential $mycreds"; string scripttext3 = "Import-PSSession -Session $s"; string scripttext4 = "Import-Module virtualmachinemanager"; string scripttext5 = "Get-SCLogicalNetwork"; pipeline.Commands.AddScript(scripttext); pipeline.Commands.AddScript(scripttext1); pipeline.Commands.AddScript(scripttext2); pipeline.Commands.AddScript(scripttext3); pipeline.Commands.AddScript(scripttext4); pipeline.Commands.AddScript(scripttext5); Collection<PSObject> results = pipeline.Invoke(); runspace.Close(); }
Sample on Console :
static void Main(string[] args) { Runspace runspace = RunspaceFactory.CreateRunspace(); runspace.Open(); Pipeline pipeline = runspace.CreatePipeline(); string scripttext = "$secpasswd = ConvertTo-SecureString 'password' -AsPlainText –Force"; string scripttext1 = @"$mycreds = New-object -typename System.Management.Automation.PSCredential('login',$secpasswd)"; string scripttext2 = "$s = New-PSSession -ComputerName scvmm -Credential $mycreds"; string scripttext3 = "Import-PSSession -Session $s"; string scripttext4 = "Import-Module virtualmachinemanager"; string scripttext5 = "Get-SCLogicalNetwork"; pipeline.Commands.AddScript(scripttext); pipeline.Commands.AddScript(scripttext1); pipeline.Commands.AddScript(scripttext2); pipeline.Commands.AddScript(scripttext3); pipeline.Commands.AddScript(scripttext4); pipeline.Commands.AddScript(scripttext5); Collection<PSObject> results = pipeline.Invoke(); foreach (var item in results) { Console.WriteLine(item.BaseObject.ToString()); }; Console.ReadLine(); runspace.Close(); }
Hello,
Currently the SCVMM provider is no longer working and has not been updated for some time. Its recommended to use the HyperV provider.
Regards,
Trevor