Hi,
When I run my script inside PowerShell Universal Dashboard I always get this error;
"Error getting value from 'ExtensionData' on 'VMware.VimAutomation.ViCore.Impl.V1.VIServerImpl'."
Everything works but after that error I can't run the script again until I have closed the PS session and opened it again.
The Script are working in powershell console. But I can't find out why I can't run it inside PowerShell Dashboard multi-times in a row. I can do it in PS console so I guess my script are not the issue..... I can hammer the script inside the console.
Which PowerCLI version are you using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi, I have 12.2.0.17538434
You do know that PowerCLI is not thread-safe.
Possibly that might be something that this Dashboard is using.
In 12.2, PowerCLI introduced the concept of context (the Get-PowerCliContext and the Use-PowerCliContext cmdlets, see New Release – VMware PowerCLI 12.2) to support the Parallel switch on the Foreach cmdlet..
This might be something that could help, but I guess you better ask the creator of the Dashboard.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Don't think he know whats the issue are as he just provide with the plattform.
But I guess that I need to take a look at it, as it works with pure Powershell Console then the code are not the issue is my guess and as it works one time then it give the error below and stop working until i Reload the PS console that the dashboard are running in.
PowerShell Universal - Ironman Software
There is the plattform.
Connect-VIServer -Server $VISrvCreate -Credential $VMWareAuth
$VDICreateClusterName = Get-Cluster -Name mar*
$VDICreateDatastore = Get-Datastore -Name mar*
$VDICreateLocation = "$($VDIType)-$($SelectedPOD)"
$VDICreateVDIHost = Get-Cluster $VDICreateClusterName | Get-VMHost | Where-Object { $_.ConnectionState -eq 'connected' } | Get-Random
New-VM -Name $VDIADName -Template $VDIType -VMHost $VDICreateVDIHost -Datastore $VDICreateDatastore -Location $VDICreateLocation -Notes "Skapades: $($CreatedDate.ToString("yyyy-MM-dd"))`nAnvänds av: $($VDIADUsr)`nObjekt: $($VDIObj)`nBeställare: $($VDIOrder)`nKostnadsställe: $($VDIKst)"
##Event log med info vad som har skapats osv.
Connect-HVServer -Server $HVSrvCreate -Credential $VMWareAuth
Add-hvdesktop -poolname $VDICreateLocation -machines $VDIADName
start-sleep -s 3
##Event log
Set-HVMachine -MachineName $VDIADName -Maintenance ENTER_MAINTENANCE_MODE
##Event log
Disconnect-HVServer -Server $HVSrvCreate -Force -Confirm:$false
Disconnect-VIServer -Server $VISrvCreate -Force -Confirm:$false
No, but he can probably tell you how his Dashboard runs these scripts.
If he uses Runspaces, that could explain the issue you see.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference