Monday, March 26, 2018

Horizon view | Powercli command to get the number of VM's in all pool

This  is a Horizon view  Powercli command to get the number of VM's in all available pool with status connected/disconnected.


Get-Pool | %{
   $remote = Get-RemoteSession -Pool_id $_.Pool_id
   $_ | Select @{N="Name";E={$_.Pool_id}},
     @{N="VM in pool";E={Get-DesktopVM -Pool_id $_.Pool_id | Measure-Object | Select -ExpandProperty Count}},
     @{N="Connected";E={$remote | where {$_.State -eq "CONNECTED"} | Measure-Object | Select -ExpandProperty Count}},
     @{N="Disconnected";E={$remote | where {$_.State -eq "DISCONNECTED"} | Measure-Object | Select -ExpandProperty Count}}
 }



Regards
Bijesh

Sunday, March 25, 2018

Power shell Script to get Server reboot history

Being an Admin we may wanted to get server reboot history.We can get it through event viewer and look for event 1024.But how to filter only the reboot events.This powershell script helps to filter logs from remote system and get the desired output


Get-WinEvent -cn <Computer> -FilterHashtable @{logname='System'; id=1074}  | ForEach-Object {
$ev = New-Object PSObject | Select-Object Date, User, Action, Process, Reason, ReasonCode, Comment
$ev.Date = $_.TimeCreated
$ev.User = $_.Properties[6].Value
$ev.Process = $_.Properties[0].Value
$ev.Action = $_.Properties[4].Value
$ev.Reason = $_.Properties[2].Value
$ev.ReasonCode = $_.Properties[3].Value
$ev.Comment = $_.Properties[5].Value
$ev
} | Select-Object Date, Action, Reason, User





Regards
Bijesh

vSphere 6.5 topology and upgrade Planning Tool

Vmware tool for vSphere 6.5 topology  and upgrade Planning

https://vspherecentral.vmware.com/path-finder/




Regards
Bijesh

Saturday, March 24, 2018

Horizon view | Powercli command to get the Connected user’s list


Get-RemoteSession -State Connected |Select DNSName,Username

Regards
Bijesh

Horizon view | Powercli command to get the list of unassigned VM's


With View powercli command we can pull the list of unassigned vm's .Below is  the onliner to save the list of unassigned vm list  to C drive


Get-Pool | Select Pool_id, @{Name="Unassigned VMs";Expression={($_ | Get-DesktopVM | ? {$_.user_displayname -eq "$null"})} |Out-File c:\VMlist.txt





Regards
Bijesh

Horizon view | Powercli command to get the number of unassigned VM's



Get-Pool | Select Pool_id, @{Name="Unassigned VMs";Expression={($_ | Get-DesktopVM | ? {$_.user_displayname -eq "$null"}).Count}}


Regards
Bijesh

PowerCli -To get average cluster resources usage Report

This is a simple command to get the report  on vcenter cluster Resource usage for last 3 Days


Get-Cluster| Select Name, `
@{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}, `
@{N="Memory Usage (Average), %" ; E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Network Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat net.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Disk Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat disk.usage.average -Start (Get-Date).AddDays(-3) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} |ft



Regards
Bijesh

Power Shell Command To Get Print Queue

To Get Print Queue from a remote print server


Get-WMIObject Win32_Printer -ComputerName <PrintServerName> |Format-Table -AutoSize


Regards
Bijesh