powershell network.ps1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell network.ps1相关的知识,希望对你有一定的参考价值。

Import-Module "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager"

#Get-SCVMMServer -ComputerName 'mmbbs-vmm1' -UserRoleName 'Administrator'
$VLAN_ID = Read-Host 'Bitte VLAN ID z.B. 32 eingeben'
$SERVICE_Name = Read-Host 'Bitte VM name eingeben (* als Platzhalter)'

$vms= Get-SCVirtualMachine | Where-Object {$_.Name -like $SERVICE_Name} 

$vms | foreach {

    $netName = "Student Networks " + $VLAN_ID.ToString()
    $VMNetwork = Get-SCVMNetwork -Name $netName 
    $VMSubnet = Get-SCVMSubnet  -Name ($netName + '_0')

    $VMNetwork | ft
    $VMSubnet | ft
    
    $networkAdapter = Get-SCVirtualNetworkAdapter -VM $_
    Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $networkAdapter -VMNetwork $VMNetwork -VMSubnet $VMSubnet -VLanEnabled $true -VLanID $VLAN_ID -VirtualNetwork "Student Network Switch" -IPv4AddressType Dynamic -IPv6AddressType Dynamic -NoPortClassification
    
}

以上是关于powershell network.ps1的主要内容,如果未能解决你的问题,请参考以下文章

powershell怎么运行

powershell PowerShell:启动PowerShell作为其他用户提升

powershell [提示输入powershell] #powershell #input #prompt

powershell 测量PowerShell命令或PowerShell脚本的速度

powershell远程下载exe并执行

powershell 使用啥端口