-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet_Problem_VM_Info.ps1
49 lines (38 loc) · 1.41 KB
/
Get_Problem_VM_Info.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Get information on a VM causing an issue. Accepts either the machine name, or connected user's WatIAM as input
Import-Module VMware.VimAutomation.HorizonView
Get-Module -ListAvailable 'VMware.Hv.Helper' | Import-Module
$connected = $False
do {
try
{
$server = Connect-HVServer -Server libconvdiprd01.private.uwaterloo.ca -ErrorAction Stop
$connected = $True
}
catch
{
Write-Output "Horizon server connection failed. Please try again."
$connected = $False
}
} while( $connected -ne $True)
while ($True) {
$id = Read-Host "Enter name of VM or user's WatIAM"
if ($id -match '(LIB)|(lib)')
{
$session = Get-HVLocalSession | Where-Object {$_.NamesData.MachineOrRDSServerName -like $id}
}
else
{
$session = Get-HVLocalSession | Where-Object {$_.NamesData.UserName -like $('*' + $id)}
}
Write-Host "`nTimeStamp:"
Write-Host $(Get-Date -Format "yyyy-MM-dd HH:mm") "`n"
Write-Host "User:"
Write-Host $($session.NamesData.UserName -split "\\")[1] "`n"
Write-Host "Agent Information:"
Write-Host "Machine Name: " $session.NamesData.MachineOrRDSServerName
Write-Host "Agent Version: " $session.NamesData.AgentVersion "`n"
Write-Host "Client Information:"
Write-Host "Client Type: " $session.NamesData.ClientType
Write-Host "Client Name: " $session.NamesData.ClientName
Write-Host "Client Version: " $session.NamesData.ClientVersion`n
}