Win2012 R2 Core iSCSI configuration with PowerShell

Start relevant services and set to auto start:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Set-Service –Name MSiSCSI –StartupType Automatic
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Start-Service MSiSCSI
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-Service –Name MSiSCSI

Status Name DisplayName
—— —- ———–
Running MSiSCSI Microsoft iSCSI Initiator Service

Register the iSCSI array IP address:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> New-IscsiTargetPortal –TargetPortalAddress 192.168.105.28
InitiatorInstanceName :
InitiatorPortalAddress :
IsDataDigest : False
IsHeaderDigest : False
TargetPortalAddress : 192.168.105.28
TargetPortalPortNumber : 3260
PSComputerName :
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

Verify connectivity:
————————————————————————————–
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiTarget

IsConnected NodeAddress PSComputerName
———– ———– ————–
False iqn.2001-05.com.equallogic:4-52aed6-…
False iqn.2001-05.com.equallogic:4-52aed6-…

Check the iscsi target names in the EQL gui and use to connect:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Connect-IscsiTarget –NodeAddress iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01

AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : False
NumberOfConnections     : 1
SessionIdentifier       : ffffe00011e2b020-4000013700000003
TargetNodeAddress       : iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01
TargetSideIdentifier    : 5500
PSComputerName          :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Connect-IscsiTarget –NodeAddress iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02

AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : False
NumberOfConnections     : 1
SessionIdentifier       : ffffe00011e2b020-4000013700000004
TargetNodeAddress       : iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02
TargetSideIdentifier    : 5600
PSComputerName          :

Verify connections:
————————————————————
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiConnection
ConnectionIdentifier : ffffe00011e2b020-2
InitiatorAddress : 0.0.0.0
InitiatorPortNumber : 31188
TargetAddress : 192.168.105.28
TargetPortNumber : 3260
PSComputerName :

ConnectionIdentifier : ffffe00011e2b020-4
InitiatorAddress : 0.0.0.0
InitiatorPortNumber : 31700
TargetAddress : 192.168.105.28
TargetPortNumber : 3260
PSComputerName :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

 

Register the session so it persists across reboots:
————————————————————
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiSession

AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : True
IsHeaderDigest : False
IsPersistent : True
NumberOfConnections : 1
SessionIdentifier : ffffe00011e2b020-4000013700000003
TargetNodeAddress : iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01
TargetSideIdentifier : 5500
PSComputerName :

AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : True
IsHeaderDigest : False
IsPersistent : False
NumberOfConnections : 1
SessionIdentifier : ffffe00011e2b020-4000013700000004
TargetNodeAddress : iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02
TargetSideIdentifier : 5600
PSComputerName :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000003
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000004
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-Disk | Where-Object BusType –eq “iSCSI”

Number Friendly Name                            OperationalStatus                    Total Size Partition Style
—— ————-                            —————–                    ———- —————
3      EQLOGIC 100E-00 SCSI Disk Device         Offline                                  400 GB GPT
4      EQLOGIC 100E-00 SCSI Disk Device         Offline                               200.01 GB GPT

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

Reset XenDesktop VM name count

NOTE: For this to work the commands need to be executed via the PowerShell console in Citrix Studio. The normal PowerShell interface won’t work.

How to install the correct Hyper-V agent for your System Center installation

On the SC server, the agents to install on the Hyper-V hosts are located
under the following folder (change based on versions you want):
C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\agents\Amd64\<VERSION>\vmmAgent.msi

Like so:
===========
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\administrator>dir “C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\agents\Amd64\3.2.7672.0\vmmAgent.msi”
ドライブ C のボリューム ラベルがありません。
ボリューム シリアル番号は AC69-DFC1 です

C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\agents\Amd64\3.2.7672.0 のディレクトリ

2014/06/27 22:53 8,142,848 vmmAgent.msi
1 個のファイル 8,142,848 バイト
0 個のディレクトリ 83,961,167,872 バイトの空き領域

C:\Users\administrator>

Get the command line calendar to display week numbers

Normal calendar:

jonas@nyx:~$ cal
    October 2014      
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 24 25  
26 27 28 29 30 31     

Display the whole year:
      
jonas@nyx:~$ cal 2014
                            2014
      January               February               March          
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
          1  2  3  4                     1                     1  
 5  6  7  8  9 10 11   2  3  4  5  6  7  8   2  3  4  5  6  7  8  
12 13 14 15 16 17 18   9 10 11 12 13 14 15   9 10 11 12 13 14 15  
19 20 21 22 23 24 25  16 17 18 19 20 21 22  16 17 18 19 20 21 22  
26 27 28 29 30 31     23 24 25 26 27 28     23 24 25 26 27 28 29  
                                            30 31                 

       April                  May                   June          
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
       1  2  3  4  5               1  2  3   1  2  3  4  5  6  7  
 6  7  8  9 10 11 12   4  5  6  7  8  9 10   8  9 10 11 12 13 14  
13 14 15 16 17 18 19  11 12 13 14 15 16 17  15 16 17 18 19 20 21  
20 21 22 23 24 25 26  18 19 20 21 22 23 24  22 23 24 25 26 27 28  
27 28 29 30           25 26 27 28 29 30 31  29 30                 
                                                                  

        July                 August              September        
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
       1  2  3  4  5                  1  2      1  2  3  4  5  6  
 6  7  8  9 10 11 12   3  4  5  6  7  8  9   7  8  9 10 11 12 13  
13 14 15 16 17 18 19  10 11 12 13 14 15 16  14 15 16 17 18 19 20  
20 21 22 23 24 25 26  17 18 19 20 21 22 23  21 22 23 24 25 26 27  
27 28 29 30 31        24 25 26 27 28 29 30  28 29 30              
                      31                                          

      October               November              December        
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
          1  2  3  4                     1      1  2  3  4  5  6  
 5  6  7  8  9 10 11   2  3  4  5  6  7  8   7  8  9 10 11 12 13  
12 13 14 15 16 17 18   9 10 11 12 13 14 15  14 15 16 17 18 19 20  
19 20 21 22 23 24 25  16 17 18 19 20 21 22  21 22 23 24 25 26 27  
26 27 28 29 30 31     23 24 25 26 27 28 29  28 29 30 31           
                      30                                          
jonas@nyx:~$ 

But what if you want to see the weeks?
jonas@nyx:~$ ncal -w
August 2014
Su 3 10 17 24 31
Mo 4 11 18 25
Tu 5 12 19 26
We 6 13 20 27
Th 7 14 21 28
Fr 1 8 15 22 29
Sa 2 9 16 23 30
30 31 32 33 34 35