This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Get-DisconnectedVolumes.ps1
142 lines (135 loc) · 7.81 KB
/
Get-DisconnectedVolumes.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
$FlashArrayID = Read-Host -Prompt "Enter the Pure Storage FlashArray (IP/FQDN)"
$FlashArray = New-PfaArray -EndPoint $FlashArrayID -Credentials (Get-Credential) -IgnoreCertificateError
$ConnectedVolumes = @($null)
$AllVolumes = @($null)
$DisconnectedVolumes = @($null)
$z=0
$Hosts = Get-PfaHosts -Array $FlashArray
ForEach ($HostVol in $Hosts) {
$ConnectedVolumes += @(Get-PfaHostVolumeConnections -Array $FlashArray -Name $HostVol.name | select vol)
}
$AllVolumes = @(Get-PfaVolumes -Array $FlashArray | select name)
$hash= @{}
foreach ($i in $ConnectedVolumes) {
$Vol = $i.vol
$hash.Add($z, $Vol)
$z++
}
foreach($j in $AllVolumes) {
if(!$hash.ContainsValue($j.name)){
$DisconnectedVolumes += $j.name
}
else {
$hash.Remove($j.name)
}
}
Write-Host "==================================================="
Write-Host "Disconnected Volumes ($($DisconnectedVolumes.Count) of $($hash.Count))"
Write-Host "==================================================="
$DisconnectedVolumes
# SIG # Begin signature block
# MIITTgYJKoZIhvcNAQcCoIITPzCCEzsCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0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