70-740, Teil 1.2.4.
Nanoserver mit Windows PowerShell ferngesteuert verwalten
Ideen für die Recherche im Web:
technet nanoserver verwalten
Zum Nachschlagen:
https://docs.microsoft.com/de-de/windows-server/get-started/manage-nano-server
https://docs.microsoft.com/de-de/windows-server/get-started/powershell-on-nano-server
Übungen:
#Beispiel 1
Invoke-Command -ComputerName 10.112.4.100 -ScriptBlock {ipconfig /all}
###
# Beispiel 2
Copy-Item D:\NanoServer\NanoServerImageGenerator -Destination C:\ -Recurse
cd C:\NanoServerImageGenerator
Get-ExecutionPolicy
# Bei Bedarf: Set-ExecutionPolicy RemoteSigned
Import-Module .\NanoServerImageGenerator -Verbose
djoin /provision /domain mit.lernen /machine wd-nano2 /savefile wd-nano2.odj
dir wd-nano2.odj
New-NanoServerImage -Edition Datacenter -DeploymentType Guest -MediaPath D:\ -BasePath .\Base -TargetPath .\wd-nano2.vhdx -MaxSize 5TB -Ipv4Address 192.168.178.202 -Ipv4SubnetMask 255.255.255.0 -Ipv4Gateway 192.168.178.1 -Ipv4Dns 192.168.178.6 -EnableRemoteManagementPort -DomainBlobPath wd-nano2.odj -ReuseDomainNode -Storage -InterfaceNameOrIndex Ethernet
$var_Switch=(Get-VMSwitch | Where {$_.SwitchType -eq “External”}).Name
$var_Switch
New-VM -VHDPath C:\NanoServerImageGenerator\wd-nano2.vhdx -Generation 2 -MemoryStartupBytes 2GB -Name wd-nano2 -SwitchName $var_Switch
get-vm
Start-VM wd-nano2
get-vm
Enter-PSSession -VMName wd-nano2
Get-NetFirewallRule -DisplayGroup “*Remote*” | ft DisplayName, Enabled
Get-NetFirewallRule -DisplayGroup “*Remote*” | Enable-NetFirewallRule
Enable-NetFirewallRule -DisplayGroup “Datei- und Druckerfreigabe”
Exit-PSSession
New-VHD –Path C:\NanoServerImageGenerator\wd-nano2A.vhdx –SizeBytes 5TB
Add-VMHardDiskDrive -VMName wd-nano2 -Path C:\NanoServerImageGenerator\wd-nano2A.vhdx
Enter-PSSession -VMName wd-nano2 -Credential mit\administrator
Get-Disk | Where partitionstyle -eq ‘raw’ | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem REFS -NewFileSystemLabel “disk2” -Confirm:$false
Get-Volume
Exit-PSSession
Stop-VM -VMName wd-nano2
Mount-VHD -Path “C:\NanoServerImageGenerator\wd-nano2.vhdx”
Get-Volume
dir f:\
notepad “C:\ISOs\Readmy.txt”
mkdir “F:\ISOs\”
Copy-Item “C:\ISOs\Readmy.txt” -Destination “F:\ISOs\” -Recurse
dir f:\ISOs\