Change Windows IP address settings remotely with psexec and netsh

Download psexec from Sysinternals / MS. It only needs to be installed on the machine you run the commands from, not the targets.

Note:
* All machines must be in the same domain or workgroup
* Firewalls must be down on the targets (haven’t checked exactly which ports, so lowered them for domain access in my case)
* Ideally, create/use a local admin user on each remote machine for execution

Change from DHCP to static IP (note the “-h” for elevated admin access):
psexec \\<remote-computer-name> -u <remote-admin-user> -p <password> -h netsh interface ip set address name=”<interface-name>” static addr=<ip> <mask> <gateway> 1

Since the IP change command doesn’t include DNS settings we also need the the below:

Change DNS settings:
psexec \\<remote-computer-name> -u <user> -p <password> -h netsh interface ip set dns name=”<interface-name>” static addr=<ip>

Example changing the settings remotely on a Japanese Windows 7 machine from a Windows 2012 R2 server:
psexec \\Win7-01 -u admusr -p Passw0rd! -h netsh interface ip set address name=”ローカル エリア接続 2″ static addr=192.168.0.100 255.255.255.0 192.168.0.1 1

psexec \\Win7-01 -u admusr -p Passw0rd! -h netsh interface ip set dns name=”ローカル エリア接続 2″ static addr=8.8.8.8

 

Tip:
If you’re uncertain of the interface name: Run “ipconfig” remotely and copy and paste the interface name from there.
psexec \\<remote-computer-name> -u <remote-admin-user> -p <password> ipconfig

 

Hyper-V Error (23001) Cannot create or update a non highly available virtual machine

OK, so you created a Hyper-V cluster using clustered, shared storage (CSV) and installed SCVMM. Now when you try to deploy a VM to a cloud it won’t work. Your clouds are listed with zero stars for compatibility and the below, rather cryptic, error message will be shown:

Full Error message:
Error (23001) Cannot create or update a non highly available virtual machine because the path C:\ClusterStorage\Volume1\Virtual Hard Disks\ is a clustered resource. Recommended Action Ensure that the path exists and that the path is not a cluster disk or cluster shared volume, and then try the operation again.

Fix:
This happens if the cloud is configured to use clustered storage but the VM hardware profile doesn’t have a check in the “Make this virtual machine highly available” checkbox.

Thank you for the useful error messages MS. They really make me want to pull my hair out.

Hyper-V_HA

Enabling SNMP on a Dell MXL blade switch (running FTOS)

It’s very easy to enable SNMP 1.0 / 2.0 management of the Dell MXL blade network switches. All it takes is one command really (“snmp-server community public ro”).

SSH to the network switch (MXL):
jonas@nyx:~$ ssh root@10.1.1.100
root@10.1.1.100’s password:

Verify that there is no current SNMP configuration present:
TOKSCA4A2-MXL#show running-config snmp

Enter config mode and enable your community name – in this case “public” and specify if it’s Read-Only or Read-Write. In this case we use read only (ro):
TOKSCA4A2-MXL#conf
TOKSCA4A2-MXL(conf)#snmp-server community public ro
TOKSCA4A2-MXL(conf)#end

Verify that it worked:
TOKSCA4A2-MXL#show running-config snmp
!
snmp-server community public ro
TOKSCA4A2-MXL#

All done! Add the switch to your SNMP manager (OME for example).

 

Enabling VNC on iDRAC7 with RACADM

Example of enabling the VNC server on an iDRAC and setting the password:
racadm -r 10.1.1.200 -u root -p calvin set idrac.vncserver.enable Enabled
racadm -r 10.1.1.200 -u root -p calvin set idrac.vncserver.Password calvin

Note: Default port for VNC on the iDRAC is 5901

Connection example can be found here.

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>