I created this script to create multiple VM's remotely on the Hyper-V server, however, it doesn't seem to create the VM's. I can create one directly on the Hyper-V server using the given parameters while using Enter-PSSession, but not via invoke-command? (there are no error messages, it just prints a blank line and goes back to the prompt)
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][int]$newvmcount #require number of temp vm's to create
)
Invoke-Command -ScriptBlock {foreach ($vmnumber in $newvmcount){New-VM -Name "Windows10TMP$vmnumber" -BootDevice NetworkAdapter -Generation 2 -SwitchName LAN -MemoryStartupBytes 1gb -NewVHDPath "F:\hypervvirtualmachines\Windows10TMP$vmnumber.vhdx" -NewVHDSizeBytes 127gb -verbose}} -ComputerName hypervserver -ArgumentList $newvmcount