Skip to content

Instantly share code, notes, and snippets.

@clintcolding
Created November 7, 2018 20:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clintcolding/2e1d2364815f4b570eeeb832f852d34d to your computer and use it in GitHub Desktop.
Save clintcolding/2e1d2364815f4b570eeeb832f852d34d to your computer and use it in GitHub Desktop.
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