Tuesday, January 2, 2018

Reset a slot in Cisco UCS.

- Reset a slot (equivalent to remove power from the blade and reapplying):
     #reset slot x/y (where x = chassis and y = blade or server #)

Get all vm's with connected CD rom drives

This is a powercli command to get all the vm's with connected cdrom drive.  

get-cluster | where {$_.Name -eq "SFColo Test & Dev"} | get-vm | where { $_ | get-cddrive | where { $_.ConnectionState.Connected -eq "true" } } | select Name


Power on/off VM via command line.


Power on a VM
To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:

    vim-cmd vmsvc/getallvms |grep <vm name>

    Note: The first column of the output shows the vmid.
  2. Check the power state of the virtual machine with the command:

    vim-cmd vmsvc/power.getstate <vmid>
  3. Power-on the virtual machine with the command:

    vim-cmd vmsvc/power.on <vmid>

Wednesday, December 27, 2017

vSAN troubleshooting Commands

RVC login
localhost:~ #rvc
localhost:~ #domain\user@localhost

Disk Component Resync
Show component resync status
vsan.resync_dashboard .

Show all disk status (used/reserved, disk health, disk version)
vsan.disks_stats .

Disk Rebalance
Start Rebalance disks
vsan.proactive_rebalance --start --time-span 86400 --variance-threshold 0.30 --time-threshold 1800 --rate-threshold 100000 <cluster path>

Stop Rebalance disks
vsan.proactive_rebalance --stop <cluster path>

Check Rebalance status
vsan.proactive_rebalance_info /localhost/SouthEast/computers/Raleigh
vsan.resync_dashboard /localhost/SouthEast/computers/Raleigh

Cluster
Remove host or witness from fault domain
esxcli vsan cluster leave

Troubleshoot
esxcli vsan cluster get
vsan.check_state .
vsan.disks_info <host path>

Stress Test
/localhost/SouthCentral/computers/Houston> vsan.health.cluster_load_test_run -r houston_stress -t "Stress test" -d 28800 ./

Check vSAN upgrade status
vsan.upgrade_status -r 60 /localhost/VSAN-DC/computers/VSAN-Cluster/ 

Decrypt Files from QNAP with OpenSSL

If you have encryption enabled on your QNAP storage, to decrypt it, do the following.

Decrypt one file
     openssl enc -d -aes-256-cbc -k <decrypt password> -in filename.jpg -out filename.jpg


Decrypt multiple files in a folder.
     for f in * ; do [ -f $f ] && openssl enc -d -aes-256-cbc -k <decrypt password> -in $f -out _$f;

Change Network Failover Detection Policy on vSwitches and Portgroups

This script traverses all clusters and host and check if Beacon Probing is set the NetworkFailoverDetectionPolicy.  If Beacon Probing is set, change it to Link Status.

#import-module VMware.VimAutomation.Core
#Connect-VIServer -Server vcenter_hostname
#uncomment for testing
#$vmhosts = "hostname1","hostname2"
 
#uncomment for live run
#get the hostnames of all the hosts in every cluster
$vmhosts = get-cluster | get-vmhost | select name
foreach($vmhost in $vmhosts)
{
    #Gets all the vSwitch names that has beacon probing set on the host.
    $switch_policy = Get-VirtualSwitch -VMHost $vmhost.Name | where {$_.Name -ne "vSwitchiDRACvusb"} | Get-NicTeamingPolicy | Where-Object {$_.NetworkFailoverDetectionPolicy -eq "BeaconProbing"} | select -ExpandProperty VirtualSwitch # | select VirtualSwitch | format-wide
    if ($switch_policy)
    {
        foreach ($switch in $switch_policy)
        {
            $vs = Get-VirtualSwitch -VMHost $vmhost.Name -Name $switch
            Get-NicTeamingPolicy -VirtualSwitch $vs | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy LinkStatus
        }
    }
 
    #Gets all the port group names that has beacon probing set on the host.
    $portgroup_policy = Get-VirtualPortGroup -VMHost $vmhost | Get-NicTeamingPolicy | Where-Object {$_.NetworkFailoverDetectionPolicy -eq "BeaconProbing"} | select -ExpandProperty VirtualPortGroup
    if ($portgroup_policy)
    {
        foreach ($p in $portgroup_policy)
        {
            #Sets the nicteamingpolicy from the host and its portgroup.
            $vpg = Get-VirtualPortGroup -VMHost $vmhost.Name -Name $p
            Get-NicTeamingPolicy -VirtualPortGroup $vpg | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy LinkStatus
        }
    }
}

Wednesday, September 6, 2017

Remove a host from vSAN cluster

1. Run 'esxcli vsan cluster get' and note the number of hosts it sees in the cluster.
2. Place host in maintenance mode and select full data migration option. 3.3.
3. Remove the disk group.
4. Take it out of the cluster.
5. Run 'esxcli vsan cluster get' again and note the number of hosts it sees in the cluster. Should be one less.

Netapp Filer shutdown procedures

Power OFF:

1. SSH into Netapp Filer's BMC at 192.168.0.1
2. Login with username: naroot password: <password db - nb-nas1a>
3. Type the following at SP shell -> system console then press enter twice
4. At the login prompt username:root password: <password db>
5. Type the following at the Netapp> options autosupport.doit "Planned Outage"
6. Type the following at the Netapp>
7. cf disable
8. halt -t 0
9. Type the following at the dn-nas1b>
10. halt -t 0

*** After the halt commands are issued, wait for it to reboot into a LOADER> prompt. You can then poweroff the switches once it's at the LOADER> prompt.


Power ON:
1. Power-on the power switches to the disk shelf. (Wait 3 minutes for the disks to spin-up and settle)
2. Power-on the power switches to the controllers (Wait 10 minutes for the OS to boot-up)
3. SSH into the Netapp's BMC at 192.168.0.1
4. Login with username: naroot password: <password>
5. Type the following at SP shell -> system console then press enter twice
6. At the login prompt username:root password: <password>
7. Type the following at the Netapp> cf enable
8. Test access of CIFS shares from a computer via Windows Explorer.


Command if netapp does not boot up.
boot_ontap

Add local printer via powershell

add-printerport -name 'hn-check' -printerhostaddress '192.168.0.1'

add-printerdriver -Name 'HP LaserJet 4200/4300 PCL6 Class Driver'

add-printer -Name 'hn-check' -DriverName 'HP LaserJet 4200/4300 PCL6 Class Driver' -PortName 'hn-check'

Tuesday, August 29, 2017

VMWorld 2017

In Las Vegas attending VMWorld 2017.  This is my fifth VMWorld in a row.