I did not get many chances to use WMIC (Windows Management Instrumentation Command-line) before, but recently I have used it twice and found it is really handy! Example 1: Get local user SID wmic useraccount get name,sid Example 2: Set a local user’s password never expire wmic useraccount where "Name='user01'" set Passwordexpires=false
Category: Scripting
vCO: Virtual Machine Inventory
I used to use PowerCLI to generate the VM inventory report, now I make it available in vCO as well. The scripts defined in the ‘VM Inventory’ script block. var vms = VcPlugin.getAllVirtualMachines();var Name, Status, Power, OS, IP, CpuCore, RAM, ToolVer, Des, Log, Log1;var Num = 0, NumOn = 0, NumOff = 0; content = … Continue reading vCO: Virtual Machine Inventory
vCO: Find VM name based on UUID
My colleague asked me can I find out the VM name based on its UUID. I helped him by running a PowerCLI command: Get-VM | Foreach ($_) {If ((Get-View $_.id).config.uuid -eq "422041b7-8ccd-xxxx-xxxx-2770502e404a") {Write-host $_.name}} I was thinking why not build up a vCO workflow so they can help themselves in the future in case they … Continue reading vCO: Find VM name based on UUID
vCO: Virtual Machine Backup/Archive Workflow
The purpose of having this workflow is to allow the user to backup or archive the virtual machine by themselves. In my example, I use TSM (Tivoli Storage Manager) as the backup/archive solution. This is a really simple workflow. The key step is to run TSM Virtual Machine backup from command line then send the … Continue reading vCO: Virtual Machine Backup/Archive Workflow
ESXi PowerCLI Enable ssh service
1) Enable SSH service on all ESXi hosts.Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) }2) Enable SSH service on a single host.Start-VMHostService -HostService (Get-VMHostService -VMHost ESXi-01.my.lab | where {$_.Key -eq "TSM-SSH"})