Created
November 7, 2018 20:54
-
-
Save clintcolding/2e1d2364815f4b570eeeb832f852d34d to your computer and use it in GitHub Desktop.
Useful commands for Windows Core OS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- 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