diff --git a/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1 b/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
index 1b32f5ad..2d359912 100644
--- a/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
+++ b/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
@@ -331,7 +331,7 @@ function Get-VIEventPlus {
if(!$Entity){
$Entity = @(Get-Folder -NoRecursion)
}
- $entity | %{
+ $entity | Foreach-Object {
$eventFilter.entity.entity = $_.ExtensionData.MoRef
$eventCollector = Get-View ($eventMgr.CreateCollectorForEvents($eventFilter))
$eventsBuffer = $eventCollector.ReadNextEvents($eventnumber)
diff --git a/Plugins/20 Cluster/104 Clusters with no Host Profile.ps1 b/Plugins/20 Cluster/104 Clusters with no Host Profile.ps1
index 5d26a28e..5aa0d3ea 100644
--- a/Plugins/20 Cluster/104 Clusters with no Host Profile.ps1
+++ b/Plugins/20 Cluster/104 Clusters with no Host Profile.ps1
@@ -10,6 +10,6 @@ $PluginCategory = "vSphere"
# End of Settings
# Get all host profiles and corresponding cluster ID (don't really care about individual hosts at this stage!)
-$HostProfiles = Get-VMHostProfile | Select-Object Name, @{Name="ClusterID";Expression={$_.ExtensionData.Entity | ?{ $_.type -eq "ClusterComputeResource" }}}
+$HostProfiles = Get-VMHostProfile | Select-Object Name, @{Name="ClusterID";Expression={$_.ExtensionData.Entity | Where-Object { $_.type -eq "ClusterComputeResource" }}}
-$clusviews | ?{($HostProfiles | Select-Object -expandProperty ClusterID) -notcontains $_.moref } | Sort-Object Name | Select-Object Name
\ No newline at end of file
+$clusviews | Where-Object {($HostProfiles | Select-Object -expandProperty ClusterID) -notcontains $_.moref } | Sort-Object Name | Select-Object Name
\ No newline at end of file
diff --git a/Plugins/20 Cluster/52 Datastore Consistency.ps1 b/Plugins/20 Cluster/52 Datastore Consistency.ps1
index 181bc3ae..1c064164 100644
--- a/Plugins/20 Cluster/52 Datastore Consistency.ps1
+++ b/Plugins/20 Cluster/52 Datastore Consistency.ps1
@@ -18,7 +18,7 @@ if ($Clusters -ne $null)
{
ForEach ($Cluster in ($Clusters))
{
- $Cluster.ExtensionData.Host | %{ $h = $_; $Datastores | Where-Object {$_.ExtensionData.Host.key -contains $h}} |
+ $Cluster.ExtensionData.Host | Foreach-Object { $h = $_; $Datastores | Where-Object {$_.ExtensionData.Host.key -contains $h}} |
Where-Object {$_.Name -notmatch $DSDoNotInclude } | Group-Object Name | Where-Object { $_.Count -ne $cluster.ExtensionData.Host.count } |
Select-Object @{Name="Name"; Expression={$_.Group.name}}, @{Name="Cluster";Expression={$Cluster.Name}}
}
diff --git a/Plugins/20 Cluster/70 Cluster Node Version.ps1 b/Plugins/20 Cluster/70 Cluster Node Version.ps1
index 3397b7fd..9ea0eed6 100644
--- a/Plugins/20 Cluster/70 Cluster Node Version.ps1
+++ b/Plugins/20 Cluster/70 Cluster Node Version.ps1
@@ -11,7 +11,7 @@ $PluginCategory = "vSphere"
$HostsVer = @()
foreach ($clusview in $clusviews) {
- $HostsVerMiss = $HostsViews | ?{ $_.Parent -match "^$($clusview.MoRef)$"} | Select-Object @{N="FullName";E={$_.Config.Product.FullName}} -Unique
+ $HostsVerMiss = $HostsViews | Where-Object { $_.Parent -match "^$($clusview.MoRef)$"} | Select-Object @{N="FullName";E={$_.Config.Product.FullName}} -Unique
if (($HostsVerMiss | Measure-Object).Count -gt 1) {
$allVer = ""
foreach ($Ver in $HostsVerMiss) { $allVer = $allVer + $Ver.FullName + ";" }
diff --git a/Plugins/20 Cluster/75 DRS Rules.ps1 b/Plugins/20 Cluster/75 DRS Rules.ps1
index 8bfa8b01..36e342b1 100644
--- a/Plugins/20 Cluster/75 DRS Rules.ps1
+++ b/Plugins/20 Cluster/75 DRS Rules.ps1
@@ -28,11 +28,11 @@ if ($ShowVMAffinity) { $Types += "VMAffinity"}
if ($ShowVMAntiAffinity) { $Types += "VMAntiAffinity"}
if ($ShowHostAffinity) { $Types += "VMHostAffinity"}
-$Clusters | Foreach {
+$Clusters | Foreach-Object {
Get-DrsRule -Cluster $_ -Type $Types | Where-Object { $_.Name -notmatch $excludeName } |
Select-Object Cluster, Enabled, Name, Type, @{N="VM";E={(Get-View $_.VMIDS | Select-Object -ExpandProperty Name) -join "
"}},
@{N="Rule Host";E={(Get-View $_.AffineHostIds | Select-Object -ExpandProperty Name) -join "
" }},
- @{N="Running on";E={(Get-View (Get-View $_.VMIDS | %{$_.Runtime.Host}) | Select-Object ExpandProperty Name) -join "
"}}
+ @{N="Running on";E={(Get-View (Get-View $_.VMIDS | Foreach-Object {$_.Runtime.Host}) | Select-Object ExpandProperty Name) -join "
"}}
}
$Comments = ("Contains all DRS rules defined in this vCenter - {0}" -f ($types -join ","))
diff --git a/Plugins/30 Host/07 Hosts Overcommit State.ps1 b/Plugins/30 Host/07 Hosts Overcommit State.ps1
index 8d461733..6a696c3b 100644
--- a/Plugins/30 Host/07 Hosts Overcommit State.ps1
+++ b/Plugins/30 Host/07 Hosts Overcommit State.ps1
@@ -29,7 +29,7 @@ $VMHCount = $VMH | Measure
Foreach ($VMHost in $VMH) {
Write-Progress -ID 2 -Parent 1 -Activity $plang.pluginActivity -Status $VMHost.Name -PercentComplete ((100*$i)/$VMHCount.Count)
if ($VMMem) { Clear-Variable VMMem }
- $VM | ?{$_.VMHost.Name -eq $VMHost.Name -and $_.PowerState -ne "PoweredOff"} | Foreach {
+ $VM | Where-Object {$_.VMHost.Name -eq $VMHost.Name -and $_.PowerState -ne "PoweredOff"} | Foreach-Object {
[INT]$VMMem += $_.MemoryMB
}
diff --git a/Plugins/30 Host/08 Hosts Dead LUN Path.ps1 b/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
index 6cacae6e..764d01fd 100644
--- a/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
+++ b/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
@@ -10,7 +10,7 @@ $PluginCategory = "vSphere"
# End of Settings
foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
- $esxhost | %{$_.config.storageDevice.multipathInfo.lun} | %{$_.path} | ?{$_.State -eq "Dead"} | %{
+ $esxhost | Foreach-Object {$_.config.storageDevice.multipathInfo.lun} | Foreach-Object {$_.path} | Where-Object {$_.State -eq "Dead"} | Foreach-Object {
New-Object PSObject -Property @{
VMHost = $esxhost.Name
Lunpath = $_.Name
diff --git a/Plugins/30 Host/110 Host Certificate Expiration Check.ps1 b/Plugins/30 Host/110 Host Certificate Expiration Check.ps1
index 4d95bd34..80db50f0 100644
--- a/Plugins/30 Host/110 Host Certificate Expiration Check.ps1
+++ b/Plugins/30 Host/110 Host Certificate Expiration Check.ps1
@@ -90,6 +90,6 @@ namespace PKI {
# Plugin to report on upcoming host certificate expirations
# Check for Host Certificates
-$VMH | Where-Object {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | Foreach { Test-WebServerSSL -URL $_.Name | Select-Object OriginalURi, Issuer, @{N="Expires";E={$_.Certificate.NotAfter} }, @{N="DaysTillExpire";E={(New-TimeSpan -Start (Get-Date) -End ($_.Certificate.NotAfter)).Days} }|? {$_.DaysTillExpire -le $WarningDays}}
+$VMH | Where-Object {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | Foreach-Object { Test-WebServerSSL -URL $_.Name | Select-Object OriginalURi, Issuer, @{N="Expires";E={$_.Certificate.NotAfter} }, @{N="DaysTillExpire";E={(New-TimeSpan -Start (Get-Date) -End ($_.Certificate.NotAfter)).Days} }|? {$_.DaysTillExpire -le $WarningDays}}
$Header = ("Hosts with upcoming Certificate Expirations: {0} Days" -f $WarningDays)
\ No newline at end of file
diff --git a/Plugins/30 Host/44 VMKernel Warnings.ps1 b/Plugins/30 Host/44 VMKernel Warnings.ps1
index 20e92f8e..611019b5 100644
--- a/Plugins/30 Host/44 VMKernel Warnings.ps1
+++ b/Plugins/30 Host/44 VMKernel Warnings.ps1
@@ -42,7 +42,7 @@ foreach ($VMHost in ($HostsViews)){
$Warnings = (Get-Log -VMHost ($VMHost.Name) -Key vmkernel -ErrorAction SilentlyContinue).Entries | Where-Object {$_ -match "warning"}
if ($Warnings -ne $null) {
$VMKernelWarning = @()
- $Warnings | Foreach {
+ $Warnings | Foreach-Object {
if ($simpleWarning) {
$Details = "" | Select-Object VMHost, Message
$Details.VMHost = $VMHost.Name
diff --git a/Plugins/30 Host/53 Hardware status warnings-errors.ps1 b/Plugins/30 Host/53 Hardware status warnings-errors.ps1
index a4783bbf..9da40342 100644
--- a/Plugins/30 Host/53 Hardware status warnings-errors.ps1
+++ b/Plugins/30 Host/53 Hardware status warnings-errors.ps1
@@ -9,17 +9,17 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-foreach ($HostsView in ($HostsViews|?{$_.runtime.connectionstate -eq "Connected"})) {
+foreach ($HostsView in ($HostsViews|Where-Object {$_.runtime.connectionstate -eq "Connected"})) {
$HealthStatus = ((Get-View ($HostsView).ConfigManager.HealthStatusSystem).runtime)
$HWStatus = $HealthStatus.HardwareStatusInfo
if ($HWStatus) {
- $HWStatusProp = $HWStatus|gm|?{$_.membertype -eq "property"}
- $HWStatusDetails = $HWStatusProp|%{$HWStatus.($_.name)}|?{$_.status.key -inotmatch "green" -band $_.status.key -inotmatch "unknown"}| Select-Object @{N="sensor";E={$_.name}},@{N="status";E={$_.status.key}}
- $HealthStatusDetails = ($HealthStatus.SystemHealthInfo).NumericSensorInfo|?{$_.HealthState.key -inotmatch "green" -band $_.HealthState.key -inotmatch "unknown"}|Select-Object @{N="sensor";E={$_.name}},@{N="status";E={$_.HealthState.key}}
+ $HWStatusProp = $HWStatus|gm|Where-Object {$_.membertype -eq "property"}
+ $HWStatusDetails = $HWStatusProp|Foreach-Object {$HWStatus.($_.name)}|Where-Object {$_.status.key -inotmatch "green" -band $_.status.key -inotmatch "unknown"}| Select-Object @{N="sensor";E={$_.name}},@{N="status";E={$_.status.key}}
+ $HealthStatusDetails = ($HealthStatus.SystemHealthInfo).NumericSensorInfo|Where-Object {$_.HealthState.key -inotmatch "green" -band $_.HealthState.key -inotmatch "unknown"}|Select-Object @{N="sensor";E={$_.name}},@{N="status";E={$_.HealthState.key}}
if ($HWStatusDetails) {
foreach ($HWStatusDetail in $HWStatusDetails) {
New-Object PSObject -Property @{
- Cluster = ($HostsView | %{(Get-View $_.Parent).Name})
+ Cluster = ($HostsView | Foreach-Object {(Get-View $_.Parent).Name})
Host = $HostsView.name
Sensor = $HWStatusDetail.sensor
Status = $HWStatusDetail.status
@@ -29,7 +29,7 @@ foreach ($HostsView in ($HostsViews|?{$_.runtime.connectionstate -eq "Connected"
if ($HealthStatusDetails) {
foreach ($HealthStatusDetail in $HealthStatusDetails) {
New-Object PSObject -Property @{
- Cluster = ($HostsView | %{(Get-View $_.Parent).Name})
+ Cluster = ($HostsView | Foreach-Object {(Get-View $_.Parent).Name})
Host = $HostsView.name
Sensor = $HealthStatusDetail.sensor
Status = $HealthStatusDetail.status
diff --git a/Plugins/30 Host/68 Disk Max Total Latency.ps1 b/Plugins/30 Host/68 Disk Max Total Latency.ps1
index d41bb2c1..3e2c74a7 100644
--- a/Plugins/30 Host/68 Disk Max Total Latency.ps1
+++ b/Plugins/30 Host/68 Disk Max Total Latency.ps1
@@ -16,10 +16,10 @@ $diskmaxtotallatency = Get-vCheckSetting $Title "diskmaxtotallatency" $diskmaxto
$stattotallatency = Get-vCheckSetting $Title "stattotallatency" $stattotallatency
$HostsDiskLatency = @()
-foreach ($VMHost in $VMH | ?{$_.ConnectionState -eq "Connected"}) {
+foreach ($VMHost in $VMH | Where-Object {$_.ConnectionState -eq "Connected"}) {
if ($VMHost.Version -lt 4){continue}# not an esx 4.x host
$HostDiskLatency = @()
- $VHHMaxLatency = $VMHost | get-stat -stat "disk.maxTotalLatency.latest" -start ($Date).addhours(-$stattotallatency) -finish ($Date)|?{$_.value -gt $diskmaxtotallatency}| Sort-Object Timestamp -Descending
+ $VHHMaxLatency = $VMHost | get-stat -stat "disk.maxTotalLatency.latest" -start ($Date).addhours(-$stattotallatency) -finish ($Date)|Where-Object {$_.value -gt $diskmaxtotallatency}| Sort-Object Timestamp -Descending
if ($VHHMaxLatency.Count -gt 0) {
$Details = "" | Select-Object Host, Timestamp, milliseconds
$Details.host = $VMHost.name
diff --git a/Plugins/30 Host/81 LUN Paths Check.ps1 b/Plugins/30 Host/81 LUN Paths Check.ps1
index 3d8f56f3..be9e03c9 100644
--- a/Plugins/30 Host/81 LUN Paths Check.ps1
+++ b/Plugins/30 Host/81 LUN Paths Check.ps1
@@ -17,7 +17,7 @@ $missingpaths = @()
foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
#Write-Host $esxhost.Name
$lun_array = @() # 2D array - LUN Name & Path Count
- $esxhost | %{$_.config.storageDevice.multipathInfo.lun} | %{$_.path} | ?{$_.name -like "fc.*"} | %{
+ $esxhost | Foreach-Object {$_.config.storageDevice.multipathInfo.lun} | Foreach-Object {$_.path} | Where-Object {$_.name -like "fc.*"} | Foreach-Object {
$short_path_array = $_.name.split('-')
$short_path = $short_path_array[2]
$found = $false
diff --git a/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1 b/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1
index 87f82a40..1ecd7880 100644
--- a/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1
+++ b/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1
@@ -14,7 +14,7 @@ $ExcludedVMs = ""
# Update settings where there is an override
$ExcludedVMs = Get-vCheckSetting $Title "ExcludedVMs" $ExcludedVMs
-$DatastoreClustersView | Foreach {$_.PodStorageDrsEntry.StorageDrsConfig.VMConfig} | `
+$DatastoreClustersView | Foreach-Object {$_.PodStorageDrsEntry.StorageDrsConfig.VMConfig} | `
Where-Object {$_.Enabled -eq $false -or $_.Behavior -ne $null} | `
Select-Object @{N="VM";E={Get-View $_.Vm | Select-Object -ExpandProperty Name}}, Enabled, Behavior,@{N="Datastore Cluster";E={$dc.Name}} | Where-Object { $_.VM -notmatch $ExcludedVMs }
diff --git a/Plugins/60 VM/02 Snapshot Information.ps1 b/Plugins/60 VM/02 Snapshot Information.ps1
index 041469ff..3dae759c 100644
--- a/Plugins/60 VM/02 Snapshot Information.ps1
+++ b/Plugins/60 VM/02 Snapshot Information.ps1
@@ -79,7 +79,7 @@ function Get-SnapshotExtra ($snap){
$dummy = $collectionImpl.RewindCollector
$collection = $collectionImpl.ReadNextTasks($tasknumber)
while($collection -ne $null){
- $collection | Where-Object {$_.DescriptionId -eq "VirtualMachine.createSnapshot" -and $_.State -eq "success" -and $_.EntityName -eq $guestName} | %{
+ $collection | Where-Object {$_.DescriptionId -eq "VirtualMachine.createSnapshot" -and $_.State -eq "success" -and $_.EntityName -eq $guestName} | Foreach-Object {
$row = New-Object PsObject
$row | Add-Member -MemberType NoteProperty -Name User -Value $_.Reason.UserName
$vm = Get-View $_.Entity
diff --git a/Plugins/60 VM/04 Map disk region event.ps1 b/Plugins/60 VM/04 Map disk region event.ps1
index b195dfad..9f4d9434 100644
--- a/Plugins/60 VM/04 Map disk region event.ps1
+++ b/Plugins/60 VM/04 Map disk region event.ps1
@@ -13,7 +13,7 @@ $eventAge = 5
# Update settings where there is an override
$eventAge = Get-vCheckSetting $Title "eventAge" $eventAge
-Get-VIEventPlus -Start ($Date).AddDays(-$eventAge) -Type Info | Where-Object {$_.FullFormattedMessage -match "Map disk region"} | Foreach {$_.vm}| Select-Object name |Sort-Object -unique
+Get-VIEventPlus -Start ($Date).AddDays(-$eventAge) -Type Info | Where-Object {$_.FullFormattedMessage -match "Map disk region"} | Foreach-Object {$_.vm}| Select-Object name |Sort-Object -unique
$Header = ("Map disk region event (Last {0} Day(s)): [count]" -f $eventAge)
diff --git a/Plugins/60 VM/102 VM Logging.ps1 b/Plugins/60 VM/102 VM Logging.ps1
index 55832a03..69f31214 100644
--- a/Plugins/60 VM/102 VM Logging.ps1
+++ b/Plugins/60 VM/102 VM Logging.ps1
@@ -16,7 +16,7 @@ $RotateSize = 1000000
$KeepOld = Get-vCheckSetting $Title "KeepOld" $KeepOld
$RotateSize = Get-vCheckSetting $Title "RotateSize" $RotateSize
-$VM | Foreach {
+$VM | Foreach-Object {
$VMKeepOld = $_.ExtensionData.Config.ExtraConfig | Where-Object {$_.Key -eq "log.keepold"} | Select-Object -ExpandProperty Value
$VMRotateSize = $_.ExtensionData.Config.ExtraConfig | Where-Object {$_.Key -eq "log.rotatesize"} | Select-Object -ExpandProperty Value
diff --git a/Plugins/60 VM/14 VMs restarted due to Guest OS Error.ps1 b/Plugins/60 VM/14 VMs restarted due to Guest OS Error.ps1
index 6cd95043..51390599 100644
--- a/Plugins/60 VM/14 VMs restarted due to Guest OS Error.ps1
+++ b/Plugins/60 VM/14 VMs restarted due to Guest OS Error.ps1
@@ -13,7 +13,7 @@ $HAVMresetold = 5
# Update settings where there is an override
$HAVMresetold = Get-vCheckSetting $Title "HAVMresetold" $HAVMresetold
-Get-VIEventPlus -Start ($Date).AddDays(-$HAVMresetold) -Type Info | ?{$_.FullFormattedMessage -match "reset due to a guest OS error"} |Select-Object CreatedTime,FullFormattedMessage | Sort-Object Sort-Object CreatedTime -Descending
+Get-VIEventPlus -Start ($Date).AddDays(-$HAVMresetold) -Type Info | Where-Object {$_.FullFormattedMessage -match "reset due to a guest OS error"} |Select-Object CreatedTime,FullFormattedMessage | Sort-Object Sort-Object CreatedTime -Descending
$Comments = ("The following VMs have been restarted by HA in the last {0} days" -f $HAVMresetold)
diff --git a/Plugins/60 VM/28 Removable Media Connected.ps1 b/Plugins/60 VM/28 Removable Media Connected.ps1
index d0053cee..ca0d2c60 100644
--- a/Plugins/60 VM/28 Removable Media Connected.ps1
+++ b/Plugins/60 VM/28 Removable Media Connected.ps1
@@ -14,8 +14,8 @@ $IgnoreVMMedia = ""
# Update settings where there is an override
$IgnoreVMMedia = Get-vCheckSetting $Title "IgnoreVMMedia" $IgnoreVMMedia
-$FullVM | ?{$_.runtime.powerState -eq "PoweredOn" -And $_.Name -notmatch $IgnoreVMMedia} |
- % { $VMName = $_.Name; $_.config.hardware.device | ?{($_ -is [VMware.Vim.VirtualFloppy] -or $_ -is [VMware.Vim.VirtualCdrom]) -and $_.Connectable.Connected} |
+$FullVM | Where-Object {$_.runtime.powerState -eq "PoweredOn" -And $_.Name -notmatch $IgnoreVMMedia} |
+ % { $VMName = $_.Name; $_.config.hardware.device | Where-Object {($_ -is [VMware.Vim.VirtualFloppy] -or $_ -is [VMware.Vim.VirtualCdrom]) -and $_.Connectable.Connected} |
Select-Object @{Name="VMName"; Expression={ $VMName}},
@{Name="Device Type"; Expression={ $_.GetType().Name}},
@{Name="Device Name"; Expression={ $_.DeviceInfo.Label}},
diff --git a/Plugins/60 VM/30 Single Storage VMs.ps1 b/Plugins/60 VM/30 Single Storage VMs.ps1
index 3c673f5c..29824fa3 100644
--- a/Plugins/60 VM/30 Single Storage VMs.ps1
+++ b/Plugins/60 VM/30 Single Storage VMs.ps1
@@ -14,9 +14,9 @@ $LVMDoNotInclude = "Template_*|VDI*"
# Update settings where there is an override
$LVMDoNotInclude = Get-vCheckSetting $Title "LVMDoNotInclude" $LVMDoNotInclude
-$unSharedDatastore = $storageviews | ?{-Not $_.summary.multiplehostaccess} | Select-Object -Expand Name
+$unSharedDatastore = $storageviews | Where-Object {-Not $_.summary.multiplehostaccess} | Select-Object -Expand Name
-$FullVM | ?{$_.Name -notmatch $LVMDoNotInclude} | ?{$_.Runtime.ConnectionState -notmatch "invalid|orphaned"} | %{$_.layoutex.file} | ?{$_.type -ne "log" -and $_.name -notmatch ".vswp$" -And $unSharedDatastore -contains $_.name.Split(']')[0].Split('[')[1]} | Select-Object Name
+$FullVM | Where-Object {$_.Name -notmatch $LVMDoNotInclude} | Where-Object {$_.Runtime.ConnectionState -notmatch "invalid|orphaned"} | Foreach-Object {$_.layoutex.file} | Where-Object {$_.type -ne "log" -and $_.name -notmatch ".vswp$" -And $unSharedDatastore -contains $_.name.Split(']')[0].Split('[')[1]} | Select-Object Name
# Change Log
## 1.4 : Added Get-vCheckSetting
\ No newline at end of file
diff --git a/Plugins/60 VM/37 VM Alarms.ps1 b/Plugins/60 VM/37 VM Alarms.ps1
index 367cd069..e52c39de 100644
--- a/Plugins/60 VM/37 VM Alarms.ps1
+++ b/Plugins/60 VM/37 VM Alarms.ps1
@@ -14,7 +14,7 @@ foreach ($VMView in ($FullVM | Where-Object {$_.TriggeredAlarmState})){
Foreach ($VMsTriggeredAlarm in $VMView.TriggeredAlarmState){
New-Object -TypeName PSObject -Property @{
Object = $VMView.name
- Alarm = ($valarms |?{$_.value -eq ($VMsTriggeredAlarm.alarm.value)}).name
+ Alarm = ($valarms |Where-Object {$_.value -eq ($VMsTriggeredAlarm.alarm.value)}).name
Status = $VMsTriggeredAlarm.OverallStatus
Time = $VMsTriggeredAlarm.time
}
diff --git a/Plugins/60 VM/40 VCB Garbage.ps1 b/Plugins/60 VM/40 VCB Garbage.ps1
index ed0e911a..070bee97 100644
--- a/Plugins/60 VM/40 VCB Garbage.ps1
+++ b/Plugins/60 VM/40 VCB Garbage.ps1
@@ -10,4 +10,4 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$FullVM | ?{$_.snapshot | %{$_.rootsnapshotlist | ?{$_.name -contains "VCB|Consolidate|veeam|NBU_SNAPSHOT"}}} | Sort-Object Name | Select-Object Name
\ No newline at end of file
+$FullVM | Where-Object {$_.snapshot | Foreach-Object {$_.rootsnapshotlist | Where-Object {$_.name -contains "VCB|Consolidate|veeam|NBU_SNAPSHOT"}}} | Sort-Object Name | Select-Object Name
\ No newline at end of file
diff --git a/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1 b/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1
index 118ddb8f..9bc12356 100644
--- a/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1
+++ b/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1
@@ -10,5 +10,5 @@ $PluginCategory = "vSphere"
# End of Settings
$htabHostVersion = @{}
-$HostsViews | %{$htabHostVersion.Add($_.MoRef,$_.config.product.version)}
-$FullVM | ?{$htabHostVersion[$_.runtime.host].Split('.')[0] -ge 5 -and $_.runtime.consolidationNeeded} | Sort-Object -Property Name | Select-Object Name,@{N="Consolidation needed";E={$_.Runtime.consolidationNeeded}}
\ No newline at end of file
+$HostsViews | Foreach-Object {$htabHostVersion.Add($_.MoRef,$_.config.product.version)}
+$FullVM | Where-Object {$htabHostVersion[$_.runtime.host].Split('.')[0] -ge 5 -and $_.runtime.consolidationNeeded} | Sort-Object -Property Name | Select-Object Name,@{N="Consolidation needed";E={$_.Runtime.consolidationNeeded}}
\ No newline at end of file
diff --git a/Plugins/60 VM/50 VMs with CPU or Memory Limits Configured.ps1 b/Plugins/60 VM/50 VMs with CPU or Memory Limits Configured.ps1
index ad1f9218..f44ab3aa 100644
--- a/Plugins/60 VM/50 VMs with CPU or Memory Limits Configured.ps1
+++ b/Plugins/60 VM/50 VMs with CPU or Memory Limits Configured.ps1
@@ -9,4 +9,4 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$FullVM | ?{$_.config.cpuallocation.limit -ne "-1" -or $_.config.memoryallocation.limit -ne "-1"} | Select-Object Name, @{Name="CpuLimitMhz";E={$_.config.cpuallocation.limit}}, @{Name="MemLimitMB";E={$_.config.memoryallocation.limit}}
\ No newline at end of file
+$FullVM | Where-Object {$_.config.cpuallocation.limit -ne "-1" -or $_.config.memoryallocation.limit -ne "-1"} | Select-Object Name, @{Name="CpuLimitMhz";E={$_.config.cpuallocation.limit}}, @{Name="MemLimitMB";E={$_.config.memoryallocation.limit}}
\ No newline at end of file
diff --git a/Plugins/60 VM/62 Unwanted Virtual Hardware.ps1 b/Plugins/60 VM/62 Unwanted Virtual Hardware.ps1
index db340cd2..2ce911d6 100644
--- a/Plugins/60 VM/62 Unwanted Virtual Hardware.ps1
+++ b/Plugins/60 VM/62 Unwanted Virtual Hardware.ps1
@@ -15,7 +15,7 @@ $unwantedHardware = "VirtualUSBController|VirtualParallelPort|VirtualSerialPort"
$unwantedHardware = Get-vCheckSetting $Title "unwantedHardware" $unwantedHardware
foreach ($vmguest in $FullVM) {
- $vmguest.Config.Hardware.Device | Where-Object {$_.GetType().Name -match $unwantedHardware} | %{
+ $vmguest.Config.Hardware.Device | Where-Object {$_.GetType().Name -match $unwantedHardware} | Foreach-Object {
New-Object -TypeName PSObject -Property @{
Name = $vmguest.name
Label = $_.DeviceInfo.Label
diff --git a/Plugins/60 VM/66 Misnamed VM.ps1 b/Plugins/60 VM/66 Misnamed VM.ps1
index 483fc5f4..f7b35333 100644
--- a/Plugins/60 VM/66 Misnamed VM.ps1
+++ b/Plugins/60 VM/66 Misnamed VM.ps1
@@ -15,7 +15,7 @@ $MNDoNotInclude = "VM1_*|VM2_*"
$MNDoNotInclude = Get-vCheckSetting $Title "MNDoNotInclude" $MNDoNotInclude
($FullVM | Where-Object {$_.Runtime.PowerState -eq 'poweredOn' -AND $_.Name -notmatch $MNDoNotInclude -AND $_.Guest.HostName -ne "" -AND $_.Guest.HostName -notmatch $_.Name }) |
- foreach {
+ Foreach-Object {
$vmguest = $_
if ($vmguest.Parent -ne $null)
{
diff --git a/Plugins/60 VM/76 VM Network State.ps1 b/Plugins/60 VM/76 VM Network State.ps1
index b023b749..57b959d7 100644
--- a/Plugins/60 VM/76 VM Network State.ps1
+++ b/Plugins/60 VM/76 VM Network State.ps1
@@ -16,8 +16,8 @@ $ShowOnlyStartupNICS = Get-vCheckSetting $Title "ShowOnlyStartupNICS" $ShowOnlyS
$VMsNetworkNotConnected = @()
# Check only on powered on VMs
-foreach ($myVM in $FullVM | ?{$_.runtime.powerState -eq "PoweredOn"}) {
- foreach ($myCard in $myVM.config.hardware.device | ?{$_ -is [VMware.Vim.VirtualEthernetCard] -and -Not $_.connectable.connected}) {
+foreach ($myVM in $FullVM | Where-Object {$_.runtime.powerState -eq "PoweredOn"}) {
+ foreach ($myCard in $myVM.config.hardware.device | Where-Object {$_ -is [VMware.Vim.VirtualEthernetCard] -and -Not $_.connectable.connected}) {
if ($ShowOnlyStartupNICS -and $myCard.connectable.StartConnected) {
# The network card is not connected. Warn user
New-Object -TypeName PSObject -Property @{
diff --git a/vCheckUtils.ps1 b/vCheckUtils.ps1
index 067c8eaf..f0c5d6fb 100644
--- a/vCheckUtils.ps1
+++ b/vCheckUtils.ps1
@@ -136,7 +136,7 @@ function Get-vCheckPlugin
foreach ($plugin in $plugins.pluginlist.plugin)
{
$pluginObjectList | Where-Object {$_.name -eq $plugin.name -and [double]$_.version -lt [double]$plugin.version}|
- foreach{
+ Foreach-Object {
$_.status = "New Version Available - " + $plugin.version
}
if (!($pluginObjectList | Where-Object {$_.name -eq $plugin.name}))