Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful commands for Windows Core OS.
#--- Create New Volume ---#
Get-Disk | Where partitionstyle -eq 'raw' |
Initialize-Disk -PartitionStyle MBR -PassThru |
New-Partition -AssignDriveLetter -UseMaximumSize |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "disk2" -Confirm:$false
#--- Expand Disk ---#
$servers = "myserver1","myserver2"
foreach ($server in $servers) {
Invoke-Command -ComputerName $server -Credential $cred {
Update-HostStorageCache
$maxsize = (Get-PartitionSupportedSize -DriveLetter D).sizeMax
Resize-Partition -DriveLetter D -Size $maxsize
}
}
#--- Configure Search Domain ---#
Set-DnsClientGlobalSetting -SuffixSearchList "a1.local"
#--- Disable Firewall ---#
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
#--- Disable IPv6 ---#
Get-NetAdapterBinding | select Name,DisplayName,ComponentID
Disable-NetAdapterBinding -Name Ethernet0 -ComponentID ms_tcpip6
#--- Set Static IP ---#
New-NetIPAddress
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("10.27.0.5","10.27.0.6")
Remove-NetRoute -InterfaceIndex 12 -NextHop '10.27.2.1'
New-NetRoute -InterfaceIndex 12 -NextHop '10.27.2.2' -DestinationPrefix '0.0.0.0/0'
#--- Change User Password ---#
net user administrator mypassword1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment