Server 2012 / R2

Windows Server 2012 R2 Editions

Windows Server 2012 R2 editions

Features Foundation Essentials Standard Datacentre
CPU socket limit

1

2

64

64

Memory limit

32GB

64GB

4TB

4TB

Licensing model

Per server

Per server

Per CPU (pair) + CAL

Per CPU (pair) + CAL

User limit

15

25

Unlimited

Unlimited

Access service limits

50 RRAS / 10 IAS

250 RRAS / 50 IAS /
2 IAS Server Groups

Unlimited

Unlimited

Virtualisation

No

Either 1 VM or
1 physical server

2 VMs

Unlimited

Hyper-V

No

No

Yes

Yes

Server Core mode

No

No

Yes

Yes

IIS

Yes

Yes

Yes

Yes

File Services limits

1 DFS root

1 DFS root

Unlimited

Unlimited

Advertisements
General, Powershell

Get Last Reboot Date and Time – PowerShell

One of the most common questions asked when working with projects either for patching or testing or any other reason is when servers last rebooted. I have found the WMI class which will give us what we need.

Win32_OperatingSystem

So what can I get out of this class?

Get-WMIObject Win32_OperatingSystem | Get-Member

Get-CimInstance Win32_OperatingSystem | Get-Member

There is a difference we will see. Look at the definitions. This will reflect to their output.

LASTWMI

LastCIM

and LastBootUpTime what we need and we need to pull this info out of here;

Get-WMIObject -ClassName win32_OperatingSystem | select csname, lastbootuptime

csname                 lastbootuptime
——                  ————–
USER-PC             20160707090526.982130+060

And

Get-CimInstance -ClassName win32_OperatingSystem | select csname, lastbootuptime

csname                  lastbootuptime
——                   ————–
USER-PC               7/7/2016 9:05:26 AM

So looks like we need to convert the time if you use Get-WMIObject

>$wmi = gwmi win32_operatingsystem
>$wmi.ConvertToDateTime($wmi.LastBootUpTime)

or

$LastBootUpTime = Gwmi Win32_OperatingSystem -Comp server01 | Select -Exp LastBootUpTime
[System.Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime)
or

>gwmi win32_operatingsystem | %{ $_.ConvertToDateTime($_.LastBootUpTime) }

or

>$BootTime = Invoke-Command -Cn server01, server02`
  -Command { (gwmi win32_operatingsystem).lastbootuptime }
>$BootTime | foreach { ([wmi]'').ConvertToDateTime($_) }

Why do you need to go through these conversions, just use Get-CimInstance...

>$BootTimes = Get-CimInstance -Cn server1, server2-Class Win32_OperatingSystem |
    Select PSComputerName, LastBootUpTime

>$BootTimes | Format-Table -AutoSize

PSComputerName LastBootUpTime       
-------------- --------------       
server1        8/18/2016 15:40:32 PM 
server2        8/19/2016 20:50:53 PM
 If you have got a few servers put them in a txt file  (serverlist.txt) and use;

$compname = Get-Content -Path C:\serverlist.txt
foreach ($comp in $compname) {
    Get-WmiObject win32_operatingsystem -ComputerName $comp | '
select CSName, @{LABEL='LastBootUpTime';'
EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}

}
 

 

Failover Clustering, Hyper-V, Virtualization

Hyper-V 2012 Snapshots / Checkpoints

Virtual machine checkpoints (formerly known as virtual machine snapshots) capture the state, data, and hardware configuration of a running virtual machine. In Windows Server 2012 R2, virtual machine snapshots were renamed to virtual machine checkpoints in Hyper-V manager to match the terminology used in System Center Virtual Machine Management. Checkpoints provide a fast and easy way to revert the virtual machine to a previous state. For this reason, virtual machine checkpoints are intended mainly for use in development and test environments. Having an easy way to revert a virtual machine can be very useful if you need to recreate a specific state or condition so that you can troubleshoot a problem.

We have got a few options when it comes to checkpoints; create, apply and delete them.

The last two always  confuse me and I wanted to test it myself in my lab environment. I created a VM server 2012 R2 and just right clicked and choose create a checkpoint.

snap11

snap1

Folder structure;

snapFolder

Before the checkpointsnapFolder1

After the checkpoint;

snapFolder2

Now let me change some settings on the server; Background changed and a folder and a file created on the desktop.

snap3

APPLYING the CheckPoint; (I think the name is misleading)

snap4

Clicked on that…

snap5

So looks like if you want to just in case keep the changes on a different chackpoint, you can create a new one but I don’t want it now as I want to see what will happen just for applying.

snap6

VM in the background greyed out and status showing as starting..

snapRestore

And then a few seconds later status showing as RESTORING….

snap7

snap11

snap89

Looks like everything taken back to the beginning and I still got the checkpoint. So All the changes I have made have been deleted.

snapFolder2

And now what will happen if I choose DELETE CHECKPOINT

Again i have made some changes.

snap8999

snap89998

Chose delete checkpoint…..

snap89998a

It has deleted the checkpoint and also copied and saved all the changes on to the original VM.

snapFolder1

No snapshots in the folder where they normally saved.

Common Issues with deleting;

  • Deleting snapshots, but they failed to merge because there is not enough space on the disk (error 0x80070070)
Fix: If possible, free up storage space on the volume where the .vhd file is located. In some cases this might not be possible. For example, the space is occupied by .vhd and .avhd files only. If you cannot free up space on the current volume, export the virtual machine to a volume that has sufficient disk space to allow the merge to complete. The process of exporting the virtual machine to delete snapshots consists of the following steps:
  1. Export the virtual machine from the current location.
  2. Import the virtual machine to a location that has sufficient storage space. The location should be a different volume on the same host to avoid configuration problems.
  3. If the version of Hyper-V is earlier than Windows Server 2008 R2, turn on the virtual machine and then shut it down, to trigger the merge process at the new storage location.
  4. If you want to move the virtual machine back to the original location, free up additional space. Then, import the virtual machine back to the original location.

Very useful link from Microsoft….

https://technet.microsoft.com/en-us/library/dn818483(v=ws.11).aspx