Sunday, 16 March 2014

PowerShell: How much physical memory

Get-WMIObject -class win32_physicalmemory | Format-Table devicelocator, capacity –a

This PowerShell command will return the amount of memory in each slot.

MSDN: Win32_PhysicalMemory class

PowerShell domain join and computer rename

Add-Computer -DomainName Domain01 –Restart

TechNet: PowerShell Add-Computer

Rename-Computer -NewName Server044 -DomainCredential Domain01\Admin01 –Restart

TechNet: PowerShell Rename-Computer

Wednesday, 12 March 2014

Microsoft Data Classification Toolkit

This Solution Accelerator is designed to help enable an organization to identify, classify, and protect data on their file servers. The out-of-the-box classification and rule examples help organizations build and deploy their policies to protect critical information on the file servers in their environment.

Microsoft Data Classification Toolkit

Sunday, 9 March 2014

PowerShell shutdown all running Hyper-V VMs

PowerShell Script that shuts down all running virtual machines on named Hyper-V server. It shuts them down one at a time waiting while a VM shuts down before shutting down the next. Remember to substitute your <servername>. Quick way to shutdown the test environment at the end of the day.

$runningVM=Get-VM –ComputerName <servername> | Where-Object {$_.State -eq 'Running'}

foreach($cn in $runningVM){
Write-Host "Shutting down $($cn.name)"
stop-vm $cn.name -force
}

Add the following lines to shut down the Hyper-v server

Write-Host "Shutting down Hyper-V server”

Stop-Computer –computername <servername> –force

Start Virtual Machine when you start Hyper-V

I have a Virtual Machine that I want to start automatically when I start the Hyper-V server in my test environment. How would I do/undo this with PowerShell.

Start a VM called vm01 automatically

SET-VM –name vm01 –AutomaticStartAction Start

Prevent a VM called vm01 from starting automatically

SET-VM –name Vm01 –AutomaticStartAction Nothing

Wild cards a permissible – every VM that start with b

SET-VM –name b* –AutomaticStartAction Start