Skip to content

Instantly share code, notes, and snippets.

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 {
$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 ---#
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("","")
Remove-NetRoute -InterfaceIndex 12 -NextHop ''
New-NetRoute -InterfaceIndex 12 -NextHop '' -DestinationPrefix ''
#--- 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