You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
we are making use of JEA and want to establish, that our Hyper-V Operators are capable of toggling the pxe boot for their VMs.
Without JEA this can be accomplished like this:
Set-VMFirmware -VMName $vmname -FirstBootDevice (Get-VMNetworkAdapter -VMName $vmname -Name $adaptername)
In order to set FirstBootDevice, you have to pass an object of type VMComponentObject.
So what we have done is, we changed the Operator.psrc file and included following cmdlets under visible cmdlets:
'Get-VMFirmware', @{Name ='Get-VMFirmware'; Parameters=@{Name='VMName'} },
'Set-VMFirmware', @{Name ='Set-VMFirmware'; Parameters=@{Name='VMName'}, @{Name='FirstBootDevice'} },
'Get-VMNetworkAdapter', @{Name ='Get-VMNetworkAdapter'; Parameters=@{Name='VMName'}, @{Name='Name'} },
The syntax is not supported by this runspace. This can be the case if the runspace is not in language mode.
+ CategoryInfo : ParserError: ( Set-VMFirmware...Name $args[1]) :String) [], ParseException
+ FullyQualifiedErrorId : ScriptsNotAllowed
+ PSComputerName : localhost
Gathering the VMNetworkadapter in a variable and tried to passing it over the argument list is not possible, since the invoke command does not pass the networkadapter as type of VMComponentObject.
In order to set FirstBootDevice, you have to pass an object of type VMComponentObject, so passing the ID or name does not function.
I also have created a script, which I tried to call, but this also does not help. Do you have an idea how to set the firstbootorder for the vmfirmware?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
we are making use of JEA and want to establish, that our Hyper-V Operators are capable of toggling the pxe boot for their VMs.
Without JEA this can be accomplished like this:
Set-VMFirmware -VMName $vmname -FirstBootDevice (Get-VMNetworkAdapter -VMName $vmname -Name $adaptername)
In order to set FirstBootDevice, you have to pass an object of type VMComponentObject.
So what we have done is, we changed the Operator.psrc file and included following cmdlets under visible cmdlets:
'Get-VMFirmware', @{Name ='Get-VMFirmware'; Parameters=@{Name='VMName'} },
'Set-VMFirmware', @{Name ='Set-VMFirmware'; Parameters=@{Name='VMName'}, @{Name='FirstBootDevice'} },
'Get-VMNetworkAdapter', @{Name ='Get-VMNetworkAdapter'; Parameters=@{Name='VMName'}, @{Name='Name'} },
I have tried to make use of it as following:
Invoke-Command -ComputerName localhost -ConfigurationName 'Manage-HyperV' -ArgumentList $script:vm_name, $networkadaptername -ScriptBlock { Set-VMFirmware -VMName $args[0] -FirstBootDevice (Get-VMNetworkAdapter -VMName $args[0] -Name $args[1]) }
The syntax is not supported by this runspace. This can be the case if the runspace is not in language mode.
+ CategoryInfo : ParserError: ( Set-VMFirmware...Name $args[1]) :String) [], ParseException
+ FullyQualifiedErrorId : ScriptsNotAllowed
+ PSComputerName : localhost
Gathering the VMNetworkadapter in a variable and tried to passing it over the argument list is not possible, since the invoke command does not pass the networkadapter as type of VMComponentObject.
In order to set FirstBootDevice, you have to pass an object of type VMComponentObject, so passing the ID or name does not function.
I also have created a script, which I tried to call, but this also does not help. Do you have an idea how to set the firstbootorder for the vmfirmware?
The text was updated successfully, but these errors were encountered: