Friday, January 5, 2018
Power off a Virtual SAN Cluster
Power off a Virtual SAN Cluster
Prerequisites
If the vCenter Server VM is running on the Virtual SAN cluster, migrate the VM to the first host, or record the host where it is currently running.
Procedure
1
|
Power off all virtual machines that are running on the Virtual SAN cluster.
The vCenter Server virtual machine must be powered off last.
|
2
|
Place all ESXi hosts that compose the cluster in maintenance mode.
Run the esxcli command to set the Virtual SAN mode for entering the maintenance state.
esxcli system maintenanceMode set -e true -m noAction
|
3
|
Power off the ESXi hosts.
|
Bare metal recovery for Windows 2012 from a Windows Server Backup image.
Bare metal recovery for Windows 2012 from a Windows Server Backup image.
- Create an ISO of the backup image and mount it to VM.
- Install a fresh OS
- Install vmware tools.
- Reboot into Windows install ISO.
- Select System Image Recovery
- Select the command prompt.
- Type in "start /w wpeinit" to enable the network and get an ip.
- Exit the command prompt.
- Select System Image Recovery.
- Select the Operating System.
- Select the "Select a system image" radio button and next.
- Click on the "Advanced.." button.
- Click on "Search for a system image on the network"
- Type in the path of the backup. Make sure its the path that has the "WindowsImageBackup" folder or it will not detect an available image.
- Type in your credentials.
- Select the backup from the list and click Next.
Power on/off VM via command line.
Power on a VM
To power on a virtual machine from the command line:
- 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.
- Check the power state of the virtual machine with the command:
vim-cmd vmsvc/power.getstate <vmid>
- Power-on the virtual machine with the command:
vim-cmd vmsvc/power.on <vmid>
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
Get VMX and VMWare tools version and export to CSV
To get the VMware tools versions and export it to a csv called vmtools.csv
get-vm | where {$_.powerstate -ne "PoweredOff" } | where {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | % { get-view $_.id } | select Name, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}}, @{ Name="ToolStatus"; Expression={$_.Guest.ToolsVersionStatus}} | Export-Csv -NoTypeInformation -UseCulture -Path d:\vmtools.csv
Check if a user is in an AD group.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
namespace test_adgroup
{
class Program
{
static void Main(string[] args)
{
string username = "cykill";
//string username = WindowsIdentity.GetCurrent().Name;
PrincipalContext pc = new PrincipalContext(ContextType.Domain,"mydomainname");
UserPrincipal up = UserPrincipal.FindByIdentity(pc, username);
if(up.IsMemberOf(pc,IdentityType.SamAccountName,"mygroup"))
{
Console.WriteLine("In Group");
}
else
{
Console.WriteLine("Not In Group");
}
}
}
}
Caveat: This does not work for the "Domain Users" group. It always return false. I don't know why.
Update: Seems it doesn't work for large AD groups.
Disable IPv6 via commands in Windows
get-netadapterbinding
set-NetAdapterBinding -Name “Network Adapter Name” –ComponentID ms_tcpip6 –Enabled $False
new-itemproperty -Path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents -PropertyType DWord -Value ffffffff
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 #)
Subscribe to:
Posts (Atom)