Some super handy Nano Server 2016 trick’s

Here are some hany tricks!

Get all available commands

Get-Command -CommandType Cmdlet

Disk management

Get-Disk
Get-Partition
Get-Volume

Resize to max

$size = (Get-PartitionSupportedSize –DiskNumber 0 –PartitionNumber 3)
Resize-Partition -DiskNumber 0 -PartitionNumber 3 -Size $size.SizeMax

Create new partition

Initialize-Disk 1 -PartitionStyle GPT
New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter
Format-Volume -DriveLetter D

change driveletter

Get-Partition -DriveLetter D | Set-Partition -NewDriveLetter E

Set new Volume Name

Set-Volume -FileSystemLabel “MAIN” -NewFileSystemLabel “”

Create network share

mkdir ISO
net share “ISO=C:\Users\Administrator\ISO” “/GRANT:EVERYONE,FULL”

Enable dedup feature

dism /Online /Get-Features
dism /Online /Enable-Feature /FeatureName:Dedup-Core /all
Enable-DedupVolume -Volume D: -UsageType HyperV

Show saved space status

Get-DedupStatus

https://technet.microsoft.com/en-us/library/hh848441.aspx

Windows Update

Check windows update

$sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession

$scanResults = Invoke-CimMethod -InputObject $sess -MethodName ScanForUpdates -Arguments @{SearchCriteria=”IsInstalled=0″;OnlineScan=$true}

$scanResults

Install updates

$scanResults = Invoke-CimMethod -InputObject $sess -MethodName ApplyApplicableUpdates

Cleanup afterwards (uninstall not possible after this action)

dism /online /Cleanup-Image /StartComponentCleanup /ResetBase

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s