GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

Powershell

Jesús M powershell Spanisch 4 Seiten

Inhalt der Notizen (4)

Seite 1

Networking:

# ver la configuración de red actual:

Get-NetIPConfiguration -InterfaceAlias LAN

# ojo con el GW, si ha sido puesto antes por dhcp con PS puede mantener la configuracion del GW.

# en ese caso quitar -defaultgateway o ejecutar el script de abajo para borrar el GW.

New-NetIPAddress -InterfaceAlias LAN -IPAddress 192.168.10.100 -PrefixLength 24 -DefaultGateway 192.168.10.1

# para borrar la puerta de enlace

Get-NetIPAddress -InterfaceAlias LAN | Remove-NetRoute

#ojo poner una ip que no haya estado asignada anteriormente

param ([string]$nombre,[string]$ip,[string]$gw)

New-NetIPAddress -InterfaceAlias $nombre -IPAddress $ip -PrefixLength 24 -DefaultGateway $gw

# estos comandos ponen el adaptador por dhcp, pero las propiedades del GW se mantienen como estaban.

Set-NetIPInterface -InterfaceAlias LAN -Dhcp Enabled

Set-NetIPInterface -InterfaceIndex 8 -dhcp Enabled

# para borrar la puerta de enlace

Get-NetIPAddress -InterfaceAlias LAN | Remove-NetRoute

Seite 2

Configuración red en Hyper-V

#Manejo de virtual switch hyperV

Get-NetAdapter # ver adaptadores

Get-VMSwitch # ver virtual switchs

#Crear externo:

$net = Get-NetAdapter -name 'Ethernet'

New-VMSwitch -name "Internet" -AllowManagementOS $true -NetAdapterName $net.Name

#Crear interno:

New-VMSwitch -name "vmsyhost" -SwitchType internal

#Crear privado:

New-VMSwitch -name "solovm" -SwitchType private

#Borrar virtual switch:

Remove-VMSwitch -Name "solovm" -Force

Seite 3

Máquinas virtuales Hyper-V

#Creación de Maquina:

New-VM -Name alpine -NewVHDSizeBytes 10gb -NewVHDPath F:\HyperV\VHDs\alpine.vhdx -MemoryStartupBytes 1GB -Generation 1 -SwitchName internetcable

#asignar procesadores

Set-VMProcessor -VMName alpine -Count 2

#modificar memoria

Set-VMMemory -VMName alpine -StartupBytes 2GB

#añadirle dvd si no lo tiene

Add-VMDvdDrive -VMName hypervserver19 -path F:\Isos\alpine-standard-3.10.1-x86_64.iso

#cambiar el dvd

Set-VMDvdDrive -VMName test -Path F:\Isos\alpine-standard-3.10.1-x86_64.iso

#Parar maquina:

stop-VM -name alpine -force

#Borrar maquina:

Remove-VM -Name test -Force

Seite 4

Informationen

Beschreibung
recetas con powershell
Erstellt von
Jesús M
Aufrufe
19
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck