diff --git a/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1 b/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
index 72143ff8..1b32f5ad 100644
--- a/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
+++ b/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
@@ -142,7 +142,7 @@ switch ($platform.OSFamily) {
}
}
-$OpenConnection = $global:DefaultVIServers | where { $_.Name -eq $VIServer }
+$OpenConnection = $global:DefaultVIServers | Where-Object { $_.Name -eq $VIServer }
if($OpenConnection.IsConnected) {
Write-CustomOut ( "{0}: {1}" -f $pLang.connReuse, $Server )
$VIConnection = $OpenConnection
@@ -207,7 +207,7 @@ $Clusters = Get-Cluster | Sort-Object Name
Write-CustomOut $pLang.collectDatastore
$Datastores = Get-Datastore | Sort-Object Name
Write-CustomOut $pLang.collectDVM
-$FullVM = Get-View -ViewType VirtualMachine | Where {-not $_.Config.Template}
+$FullVM = Get-View -ViewType VirtualMachine | Where-Object {-not $_.Config.Template}
Write-CustomOut $pLang.collectTemplate
$VMTmpl = Get-Template
Write-CustomOut $pLang.collectDVIO
@@ -221,7 +221,7 @@ $clusviews = Get-View -ViewType ClusterComputeResource
Write-CustomOut $pLang.collectDDatastore
$storageviews = Get-View -ViewType Datastore
Write-CustomOut $pLang.collectAlarms
-$valarms = $alarmMgr.GetAlarm($null) | select value, @{N="name";E={(Get-View -Id $_).Info.Name}}
+$valarms = $alarmMgr.GetAlarm($null) | Select-Object value, @{N="name";E={(Get-View -Id $_).Info.Name}}
# Find out which version of the API we are connecting to
$VIVersion = ((Get-View ServiceInstance).Content.About.Version).Chars(0)
@@ -324,7 +324,7 @@ function Get-VIEventPlus {
$si = Get-View ServiceInstance
$schTskMgr = Get-View $si.Content.ScheduledTaskManager
$eventFilter.ScheduledTask = Get-View $schTskMgr.ScheduledTask |
- where {$_.Info.Name -match $ScheduledTask} |
+ Where-Object {$_.Info.Name -match $ScheduledTask} |
Select-Object -First 1 |
Select-Object -ExpandProperty MoRef
}
diff --git a/Plugins/00 Initialize/01 General Information.ps1 b/Plugins/00 Initialize/01 General Information.ps1
index f0a7269f..4cc84b17 100644
--- a/Plugins/00 Initialize/01 General Information.ps1
+++ b/Plugins/00 Initialize/01 General Information.ps1
@@ -32,20 +32,20 @@ $Info = New-Object -TypeName PSObject -Property @{
"Number of Templates" = (@($VMTmpl).Count)
"Number of Clusters" = (@($Clusters).Count)
"Number of Datastores" = (@($Datastores).Count)
- "Active VMs" = (@($FullVM | Where { $_.Runtime.PowerState -eq "poweredOn" }).Count)
- "In-active VMs" = (@($FullVM | Where { $_.Runtime.PowerState -eq "poweredOff" }).Count)
+ "Active VMs" = (@($FullVM | Where-Object { $_.Runtime.PowerState -eq "poweredOn" }).Count)
+ "In-active VMs" = (@($FullVM | Where-Object { $_.Runtime.PowerState -eq "poweredOff" }).Count)
}
# Don't display DRS line if 0 days are set
if ($DRSMigrateAge -gt 0) {
- $Info | Add-Member Noteproperty "DRS Migrations for last $($DRSMigrateAge) Days" (@($MigrationQuery1 | Where {$_.GetType().Name -eq "DrsVmMigratedEvent"}).Count)
+ $Info | Add-Member Noteproperty "DRS Migrations for last $($DRSMigrateAge) Days" (@($MigrationQuery1 | Where-Object {$_.GetType().Name -eq "DrsVmMigratedEvent"}).Count)
}
# Adding vSphere 5 informations
if ($VIVersion -ge 5) {
$Info | Add-Member Noteproperty "Number of Datastore Clusters" $(@($DatastoreClustersView).Count)
if (($MigrationQuery2) -and ($SDRSMigrateAge -gt 0)) {
- $Info | Add-Member Noteproperty "Storage DRS Migrations for last $($SDRSMigrateAge) Days" (@($MigrationQuery2 | Where {$_.FullFormattedMessage -imatch "(Storage vMotion){1}.*(DRS){1}"}).Count)
+ $Info | Add-Member Noteproperty "Storage DRS Migrations for last $($SDRSMigrateAge) Days" (@($MigrationQuery2 | Where-Object {$_.FullFormattedMessage -imatch "(Storage vMotion){1}.*(DRS){1}"}).Count)
}
}
diff --git a/Plugins/10 vCenter/23 VI Events.ps1 b/Plugins/10 vCenter/23 VI Events.ps1
index 3c1ae955..f90bd261 100644
--- a/Plugins/10 vCenter/23 VI Events.ps1
+++ b/Plugins/10 vCenter/23 VI Events.ps1
@@ -10,6 +10,6 @@ $PluginCategory = "vSphere"
$VCEventAge = 1
# End of Settings
-Get-VIEventPlus -Start ($Date).AddDays(-$VCEventAge ) -EventType Error | Select @{N="Host";E={$_.host.name}}, createdTime, @{N="User";E={($_.userName.split("\"))[1]}}, fullFormattedMessage
+Get-VIEventPlus -Start ($Date).AddDays(-$VCEventAge ) -EventType Error | Select-Object @{N="Host";E={$_.host.name}}, createdTime, @{N="User";E={($_.userName.split("\"))[1]}}, fullFormattedMessage
$Header = ("Error Events (Last {0} Day(s)): [count]" -f $VCEventAge)
\ No newline at end of file
diff --git a/Plugins/10 vCenter/41 vCenter Services.ps1 b/Plugins/10 vCenter/41 vCenter Services.ps1
index 067214db..04559ea9 100644
--- a/Plugins/10 vCenter/41 vCenter Services.ps1
+++ b/Plugins/10 vCenter/41 vCenter Services.ps1
@@ -5,20 +5,20 @@ If (! $VCSA) {
If (Test-Path $Credfile) {
$LoadedCredentials = Import-Clixml $Credfile
$creds = New-Object System.Management.Automation.PsCredential($LoadedCredentials.Username,($LoadedCredentials.Password | ConvertTo-SecureString))
- $Services = get-wmiobject -Credential $creds win32_service -ComputerName $VIServer -ErrorAction SilentlyContinue| Where {$_.DisplayName -like "VMware*" }
+ $Services = get-wmiobject -Credential $creds win32_service -ComputerName $VIServer -ErrorAction SilentlyContinue| Where-Object {$_.DisplayName -like "VMware*" }
} Else {
- $Services = get-wmiobject win32_service -ComputerName $VIServer -ErrorAction SilentlyContinue | Where {$_.DisplayName -like "VMware*" }
+ $Services = get-wmiobject win32_service -ComputerName $VIServer -ErrorAction SilentlyContinue | Where-Object {$_.DisplayName -like "VMware*" }
if ($Error[0].Exception.Message -match "Access is denied.") {
# Access Denied Error found so asking to store windows credentials in a file for future use
Write-Host "Current windows credentials do not allow for access to WMI on the host $VIServer, please enter Administrator credentials for this check to work, these will be stored in an encrypted file: $credfile"
$Credential = Get-Credential
$Pass = $credential.Password | ConvertFrom-SecureString
$Username = $Credential.UserName
- $Store = "" | Select Username, Password
+ $Store = "" | Select-Object Username, Password
$Store.Username = $Username
$Store.Password = $Pass
$Store | Export-Clixml $credfile
- $Services = get-wmiobject win32_service -ComputerName $VIserver -ErrorAction SilentlyContinue | Where {$_.DisplayName -like "VMware*" }
+ $Services = get-wmiobject win32_service -ComputerName $VIserver -ErrorAction SilentlyContinue | Where-Object {$_.DisplayName -like "VMware*" }
}
}
@@ -68,7 +68,7 @@ If (! $VCSA) {
$myCol += $MyDetails
}
- $Results = $MyCol | Where {$_.Name -ne $null -and $_.Health -ne "OK"}
+ $Results = $MyCol | Where-Object {$_.Name -ne $null -and $_.Health -ne "OK"}
$Results
}
diff --git a/Plugins/10 vCenter/42 Windows vCenter Error Event Logs.ps1 b/Plugins/10 vCenter/42 Windows vCenter Error Event Logs.ps1
index c6fd08e6..e651c016 100644
--- a/Plugins/10 vCenter/42 Windows vCenter Error Event Logs.ps1
+++ b/Plugins/10 vCenter/42 Windows vCenter Error Event Logs.ps1
@@ -10,20 +10,20 @@ if (! $VCSA){
If (Test-Path $Credfile) {
$LoadedCredentials = Import-Clixml $Credfile
$creds = New-Object System.Management.Automation.PsCredential($LoadedCredentials.Username,($LoadedCredentials.Password | ConvertTo-SecureString))
- $WMI = @(Get-WmiObject -cred $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -cred $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
} Else {
- $WMI = @(Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
if ($Error[0].Exception.Message -match "Access is denied.") {
# Access Denied Error found so asking to store windows credentials in a file for future use
Write-Host "Current windows credentials do not allow for access to WMI on the host $VIServer, please enter Administrator credentials for this check to work, these will be stored in an encrypted file: $credfile"
$Credential = Get-Credential
$Pass = $credential.Password | ConvertFrom-SecureString
$Username = $Credential.UserName
- $Store = "" | Select Username, Password
+ $Store = "" | Select-Object Username, Password
$Store.Username = $Username
$Store.Password = $Pass
$Store | Export-Clixml $credfile
- $WMI = @(Get-WmiObject -cred $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -cred $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
}
}
diff --git a/Plugins/10 vCenter/42 Windows vCenter Event Logs.ps1 b/Plugins/10 vCenter/42 Windows vCenter Event Logs.ps1
index 6ddd141f..7e3329cf 100644
--- a/Plugins/10 vCenter/42 Windows vCenter Event Logs.ps1
+++ b/Plugins/10 vCenter/42 Windows vCenter Event Logs.ps1
@@ -20,20 +20,20 @@ if (! $VCSA){
If (Test-Path $Credfile) {
$LoadedCredentials = Import-Clixml $Credfile
$creds = New-Object System.Management.Automation.PsCredential($LoadedCredentials.Username,($LoadedCredentials.Password | ConvertTo-SecureString))
- $WMI = @(Get-WmiObject -cred $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -cred $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
} Else {
- $WMI = @(Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
if ($Error[0].Exception.Message -match "Access is denied.") {
# Access Denied Error found so asking to store windows credentials in a file for future use
Write-Host "Current windows credentials do not allow for access to WMI on the host $VIServer, please enter Administrator credentials for this check to work, these will be stored in an encrypted file: $credfile"
$Credential = Get-Credential
$Pass = $credential.Password | ConvertFrom-SecureString
$Username = $Credential.UserName
- $Store = "" | Select Username, Password
+ $Store = "" | Select-Object Username, Password
$Store.Username = $Username
$Store.Password = $Pass
$Store | Export-Clixml $credfile
- $WMI = @(Get-WmiObject -cred $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -cred $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
}
}
diff --git a/Plugins/10 vCenter/43 Windows vCenter Warning Event Logs.ps1 b/Plugins/10 vCenter/43 Windows vCenter Warning Event Logs.ps1
index 7010a90d..12b4adc6 100644
--- a/Plugins/10 vCenter/43 Windows vCenter Warning Event Logs.ps1
+++ b/Plugins/10 vCenter/43 Windows vCenter Warning Event Logs.ps1
@@ -6,20 +6,20 @@ If (! $VCSA) {
If (Test-Path $Credfile) {
$LoadedCredentials = Import-Clixml $Credfile
$creds = New-Object System.Management.Automation.PsCredential($LoadedCredentials.Username,($LoadedCredentials.Password | ConvertTo-SecureString))
- $WMI = @(Get-WmiObject -Credential $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue| Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -Credential $creds -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue| Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
} Else {
- @($WMI = Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ @($WMI = Get-WmiObject -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
if ($Error[0].Exception.Message -match "Access is denied.") {
# Access Denied Error found so asking to store windows credentials in a file for future use
Write-Host "Current windows credentials do not allow for access to WMI on the host $VIServer, please enter Administrator credentials for this check to work, these will be stored in an encrypted file: $credfile"
$Credential = Get-Credential
$Pass = $credential.Password | ConvertFrom-SecureString
$Username = $Credential.UserName
- $Store = "" | Select Username, Password
+ $Store = "" | Select-Object Username, Password
$Store.Username = $Username
$Store.Password = $Pass
$Store | Export-Clixml $credfile
- $WMI = @(Get-WmiObject -Credential $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where {$_.Message -like "*VMware*"} | Select @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
+ $WMI = @(Get-WmiObject -Credential $Credential -computer $VIServer -query ("Select * from Win32_NTLogEvent Where Type='Warning' and TimeWritten >='" + $ConvDate + "'") -ErrorAction SilentlyContinue | Where-Object {$_.Message -like "*VMware*"} | Select-Object @{N="TimeGenerated";E={$_.ConvertToDateTime($_.TimeGenerated)}}, Message)
}
}
diff --git a/Plugins/10 vCenter/47 vCenter Session Age.ps1 b/Plugins/10 vCenter/47 vCenter Session Age.ps1
index 7f77af48..61612860 100644
--- a/Plugins/10 vCenter/47 vCenter Session Age.ps1
+++ b/Plugins/10 vCenter/47 vCenter Session Age.ps1
@@ -22,10 +22,10 @@ $vCenterSessionsDoNotInclude = Get-vCheckSetting $Title "vCenterSessionsDoNotInc
# Retrieve vCenter sessions and report any sessions that exceed the maximum session age
(Get-View $ServiceInstance.Content.SessionManager).SessionList | `
- Where {$_.LoginTime -lt (Get-Date).AddHours(-$MaxvCenterSessionAge) -AND `
+ Where-Object {$_.LoginTime -lt (Get-Date).AddHours(-$MaxvCenterSessionAge) -AND `
$_.UserName -notmatch $vCenterSessionsDoNotInclude} | `
- select LoginTime, UserName, FullName, @{N="IdleMinutes";e={([Math]::Round(((Get-Date)-($_.lastActiveTime).ToLocalTime()).TotalMinutes))}} | `
- Where {$_.IdleMinutes -ge $MinvCenterSessionAge}
+ Select-Object LoginTime, UserName, FullName, @{N="IdleMinutes";e={([Math]::Round(((Get-Date)-($_.lastActiveTime).ToLocalTime()).TotalMinutes))}} | `
+ Where-Object {$_.IdleMinutes -ge $MinvCenterSessionAge}
$Comments = "The following displays vCenter sessions that exceed the maximum session age ($MaxvCenterSessionAge Hour(s))."
diff --git a/Plugins/10 vCenter/82 License Report.ps1 b/Plugins/10 vCenter/82 License Report.ps1
index 95d135f4..7d6ac6ac 100644
--- a/Plugins/10 vCenter/82 License Report.ps1
+++ b/Plugins/10 vCenter/82 License Report.ps1
@@ -11,11 +11,11 @@ $PluginCategory = "vSphere"
$vSphereLicInfo = @()
-Foreach ($LicenseMan in Get-View ($ServiceInstance | Select -First 1).Content.LicenseManager)
+Foreach ($LicenseMan in Get-View ($ServiceInstance | Select-Object -First 1).Content.LicenseManager)
{
- ($LicenseMan | Select -ExpandProperty Licenses) | Select @{Name="VC";e={([Uri]$LicenseMan.Client.ServiceUrl).Host}}, `
- Name, LicenseKey, Total, Used, @{Name="Information";e={$_.Labels | Select -ExpandProperty Value}}, `
- @{"Name"="ExpirationDate";e={$_.Properties | Where { $_.key -eq "expirationDate" } | Select -ExpandProperty Value}}
+ ($LicenseMan | Select-Object -ExpandProperty Licenses) | Select-Object @{Name="VC";e={([Uri]$LicenseMan.Client.ServiceUrl).Host}}, `
+ Name, LicenseKey, Total, Used, @{Name="Information";e={$_.Labels | Select-Object -ExpandProperty Value}}, `
+ @{"Name"="ExpirationDate";e={$_.Properties | Where-Object { $_.key -eq "expirationDate" } | Select-Object -ExpandProperty Value}}
}
# Changelog
diff --git a/Plugins/20 Cluster/10 HA Configuration Issues.ps1 b/Plugins/20 Cluster/10 HA Configuration Issues.ps1
index 4481059a..f7d1272d 100644
--- a/Plugins/20 Cluster/10 HA Configuration Issues.ps1
+++ b/Plugins/20 Cluster/10 HA Configuration Issues.ps1
@@ -41,7 +41,7 @@ $HAIssues += $Clusters | Where-Object {$_.Name -notmatch $ClustersDoNotInclude -
Select-Object @{Name="Cluster";Expression={$_.Name}},@{Name="Configuration Issue";Expression={$pLang.HADisabled}}
# Clusters with host monitoring disabled
-$HAIssues += $clusviews | where {$_.Name -notmatch $ClustersDoNotInclude -and ( $_.Configuration.DasConfig.HostMonitoring -eq "enabled" ) -ne $ClusterHAHostMonitoringShouldBeEnabled } |
+$HAIssues += $clusviews | Where-Object {$_.Name -notmatch $ClustersDoNotInclude -and ( $_.Configuration.DasConfig.HostMonitoring -eq "enabled" ) -ne $ClusterHAHostMonitoringShouldBeEnabled } |
Select-Object @{Name="Cluster";Expression={$_.Name}}, @{N="Configuration Issue";E={$pLang.HAMonDisabled}}
# Clusters with admission Control Disabled
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 5b48cf87..5d26a28e 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 Name, @{Name="ClusterID";Expression={$_.ExtensionData.Entity | ?{ $_.type -eq "ClusterComputeResource" }}}
+$HostProfiles = Get-VMHostProfile | Select-Object Name, @{Name="ClusterID";Expression={$_.ExtensionData.Entity | ?{ $_.type -eq "ClusterComputeResource" }}}
-$clusviews | ?{($HostProfiles | Select -expandProperty ClusterID) -notcontains $_.moref } | Sort-Object Name | Select Name
\ No newline at end of file
+$clusviews | ?{($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/17 DRS Migrations.ps1 b/Plugins/20 Cluster/17 DRS Migrations.ps1
index 3a0a565b..68089dcd 100644
--- a/Plugins/20 Cluster/17 DRS Migrations.ps1
+++ b/Plugins/20 Cluster/17 DRS Migrations.ps1
@@ -33,8 +33,8 @@ if (-not $MigrationQuery1)
}
}
-$DRSMigrations = @($MigrationQuery1 | Where {$_.Gettype().Name -eq "DrsVmMigratedEvent"} | Select createdTime, fullFormattedMessage)
-$SDRSMigrations = @($MigrationQuery2 | Where {$_.FullFormattedMessage -imatch "(Storage vMotion){1}.*(DRS){1}"} | Select createdTime, fullFormattedMessage)
+$DRSMigrations = @($MigrationQuery1 | Where-Object {$_.Gettype().Name -eq "DrsVmMigratedEvent"} | Select-Object createdTime, fullFormattedMessage)
+$SDRSMigrations = @($MigrationQuery2 | Where-Object {$_.FullFormattedMessage -imatch "(Storage vMotion){1}.*(DRS){1}"} | Select-Object createdTime, fullFormattedMessage)
$DRSMigrations
$SDRSMigrations
diff --git a/Plugins/20 Cluster/38 Cluster Configuration Issues.ps1 b/Plugins/20 Cluster/38 Cluster Configuration Issues.ps1
index 30279cbc..c64fb860 100644
--- a/Plugins/20 Cluster/38 Cluster Configuration Issues.ps1
+++ b/Plugins/20 Cluster/38 Cluster Configuration Issues.ps1
@@ -22,4 +22,4 @@ foreach ($clusview in $clusviews) {
}
}
-$clualarms | sort name
\ No newline at end of file
+$clualarms | Sort-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 82b54c7d..181bc3ae 100644
--- a/Plugins/20 Cluster/52 Datastore Consistency.ps1
+++ b/Plugins/20 Cluster/52 Datastore Consistency.ps1
@@ -18,8 +18,8 @@ if ($Clusters -ne $null)
{
ForEach ($Cluster in ($Clusters))
{
- $Cluster.ExtensionData.Host | %{ $h = $_; $Datastores | Where {$_.ExtensionData.Host.key -contains $h}} |
- Where {$_.Name -notmatch $DSDoNotInclude } | Group-Object Name | Where { $_.Count -ne $cluster.ExtensionData.Host.count } |
- Select @{Name="Name"; Expression={$_.Group.name}}, @{Name="Cluster";Expression={$Cluster.Name}}
+ $Cluster.ExtensionData.Host | %{ $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}}
}
}
\ No newline at end of file
diff --git a/Plugins/20 Cluster/70 Cluster Node Version.ps1 b/Plugins/20 Cluster/70 Cluster Node Version.ps1
index 13069d3d..3397b7fd 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 @{N="FullName";E={$_.Config.Product.FullName}} -Unique
+ $HostsVerMiss = $HostsViews | ?{ $_.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 + ";" }
@@ -27,4 +27,4 @@ foreach ($clusview in $clusviews) {
}
}
-$HostsVer | Sort Cluster
\ No newline at end of file
+$HostsVer | Sort-Object Cluster
\ No newline at end of file
diff --git a/Plugins/20 Cluster/71 Capacity Planning.ps1 b/Plugins/20 Cluster/71 Capacity Planning.ps1
index a697f594..74ff7fd4 100644
--- a/Plugins/20 Cluster/71 Capacity Planning.ps1
+++ b/Plugins/20 Cluster/71 Capacity Planning.ps1
@@ -19,7 +19,7 @@ $limitResourceCPUClusNonHA = Get-vCheckSetting $Title "limitResourceCPUClusNonHA
$limitResourceMEMClusNonHA = Get-vCheckSetting $Title "limitResourceMEMClusNonHA" $limitResourceMEMClusNonHA
$capacityinfo = @()
-foreach ($cluv in ($clusviews | Where {$_.Summary.NumHosts -gt 0 } | Sort Name)) {
+foreach ($cluv in ($clusviews | Where-Object {$_.Summary.NumHosts -gt 0 } | Sort-Object Name)) {
if ( $cluv.Configuration.DasConfig.Enabled -eq $true ) {
$DasRealCpuCapacity = $cluv.Summary.EffectiveCpu - (($cluv.Summary.EffectiveCpu * $cluv.Configuration.DasConfig.FailoverLevel)/$cluv.Summary.NumHosts)
@@ -29,7 +29,7 @@ foreach ($cluv in ($clusviews | Where {$_.Summary.NumHosts -gt 0 } | Sort Name))
$DasRealMemCapacity = $cluv.Summary.EffectiveMemory * $limitResourceMEMClusNonHA
}
- $cluvmlist = $VM | where { $cluv.Host -contains $_.VMHost.Id }
+ $cluvmlist = $VM | Where-Object { $cluv.Host -contains $_.VMHost.Id }
#CPU
$CluCpuUsage = (get-view $cluv.ResourcePool).Summary.runtime.cpu.OverallUsage
@@ -74,4 +74,4 @@ foreach ($cluv in ($clusviews | Where {$_.Summary.NumHosts -gt 0 } | Sort Name))
$capacityinfo += $clucapacity
}
-$capacityinfo | Sort Datacenter, ClusterName
\ No newline at end of file
+$capacityinfo | Sort-Object Datacenter, ClusterName
\ No newline at end of file
diff --git a/Plugins/20 Cluster/72 s-vMotion Information.ps1 b/Plugins/20 Cluster/72 s-vMotion Information.ps1
index f1d70e15..b802880f 100644
--- a/Plugins/20 Cluster/72 s-vMotion Information.ps1
+++ b/Plugins/20 Cluster/72 s-vMotion Information.ps1
@@ -54,8 +54,8 @@ foreach($vmotion in ($vmotions | Sort-object CreatedTime | Group-Object ChainID)
}
}
# Filter out unwanted vMotion Events
-if (-not $IncludevMotions) { $Motions = $Motions | Where { $_.Type -ne "vMotion" }}
-if (-not $IncludeSvMotions) { $Motions = $Motions | Where { $_.Type -ne "SvMotion" }}
+if (-not $IncludevMotions) { $Motions = $Motions | Where-Object { $_.Type -ne "vMotion" }}
+if (-not $IncludeSvMotions) { $Motions = $Motions | Where-Object { $_.Type -ne "SvMotion" }}
$Motions
$Header = ("s/vMotion Information (Over {0} Days Old): [count]" -f $vMotionAge)
diff --git a/Plugins/20 Cluster/73 VM - More RAM than free space on Datastore.ps1 b/Plugins/20 Cluster/73 VM - More RAM than free space on Datastore.ps1
index 8ddf1ed8..d3a18e77 100644
--- a/Plugins/20 Cluster/73 VM - More RAM than free space on Datastore.ps1
+++ b/Plugins/20 Cluster/73 VM - More RAM than free space on Datastore.ps1
@@ -9,6 +9,6 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$VM | Where {$_.PowerState -eq "PoweredOn"} |
- Select Name, MemoryMB, @{"Name"="FreeSpaceMB";e={($Datastores|Where {$_.Name -eq (($Machine.ExtensionData.Config.Files.VmPathName).Split('[')[1]).Split(']')[0]}).FreeSpaceMB}} |
- Where {($_.FreeSpaceMB -ne $null) -and ($_.MemoryMB -gt $_.FreeSpaceMB)} | Sort Name
\ No newline at end of file
+$VM | Where-Object {$_.PowerState -eq "PoweredOn"} |
+ Select-Object Name, MemoryMB, @{"Name"="FreeSpaceMB";e={($Datastores | Where-Object {$_.Name -eq (($Machine.ExtensionData.Config.Files.VmPathName).Split('[')[1]).Split(']')[0]}).FreeSpaceMB}} |
+ Where-Object {($_.FreeSpaceMB -ne $null) -and ($_.MemoryMB -gt $_.FreeSpaceMB)} | Sort-Object Name
\ No newline at end of file
diff --git a/Plugins/20 Cluster/75 DRS Rules.ps1 b/Plugins/20 Cluster/75 DRS Rules.ps1
index 1cb4601c..8bfa8b01 100644
--- a/Plugins/20 Cluster/75 DRS Rules.ps1
+++ b/Plugins/20 Cluster/75 DRS Rules.ps1
@@ -29,10 +29,10 @@ if ($ShowVMAntiAffinity) { $Types += "VMAntiAffinity"}
if ($ShowHostAffinity) { $Types += "VMHostAffinity"}
$Clusters | Foreach {
- Get-DrsRule -Cluster $_ -Type $Types | Where { $_.Name -notmatch $excludeName } |
- Select Cluster, Enabled, Name, Type, @{N="VM";E={(Get-View $_.VMIDS | Select -ExpandProperty Name) -join "
"}},
- @{N="Rule Host";E={(Get-View $_.AffineHostIds | Select -ExpandProperty Name) -join "
" }},
- @{N="Running on";E={(Get-View (Get-View $_.VMIDS | %{$_.Runtime.Host}) | Select -ExpandProperty Name) -join "
"}}
+ 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 "
"}}
}
$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 4175d298..8d461733 100644
--- a/Plugins/30 Host/07 Hosts Overcommit State.ps1
+++ b/Plugins/30 Host/07 Hosts Overcommit State.ps1
@@ -57,4 +57,4 @@ Foreach ($VMHost in $VMH) {
}
Write-Progress -ID 2 -Parent 1 -Activity $plang.pluginActivity -Status $lang.Complete -Completed
-$OverCommit | Select Host, "TotalMem$Units", "TotalAssignedMem$Units", "TotalUsed$Units", "OverCommit$Units"
+$OverCommit | Select-Object Host, "TotalMem$Units", "TotalAssignedMem$Units", "TotalUsed$Units", "OverCommit$Units"
diff --git a/Plugins/30 Host/08 Hosts Dead LUN Path.ps1 b/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
index 2a3fb226..6cacae6e 100644
--- a/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
+++ b/Plugins/30 Host/08 Hosts Dead LUN Path.ps1
@@ -9,7 +9,7 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-foreach ($esxhost in ($HostsViews | where {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
+foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
$esxhost | %{$_.config.storageDevice.multipathInfo.lun} | %{$_.path} | ?{$_.State -eq "Dead"} | %{
New-Object PSObject -Property @{
VMHost = $esxhost.Name
diff --git a/Plugins/30 Host/105 Host Profile Compliance.ps1 b/Plugins/30 Host/105 Host Profile Compliance.ps1
index 337776ed..e251751e 100644
--- a/Plugins/30 Host/105 Host Profile Compliance.ps1
+++ b/Plugins/30 Host/105 Host Profile Compliance.ps1
@@ -34,32 +34,32 @@ foreach ($Profile in $HostProfiles) {
$Failures = $Profile | Test-VMHostProfileCompliance -UseCache
# Find all Hosts with HP Applied and status
- $VMHosts = @($VMH | Where {(($Profile.ExtensionData.entity | Where {$_.type -eq "HostSystem" } | Select @{n="Id";e={"HostSystem-{0}" -f $_.Value}}) | Select -expandProperty Id) -contains $_.Id})
+ $VMHosts = @($VMH | Where-Object {(($Profile.ExtensionData.entity | Where-Object {$_.type -eq "HostSystem" } | Select-Object @{n="Id";e={"HostSystem-{0}" -f $_.Value}}) | Select-Object -expandProperty Id) -contains $_.Id})
# Filter out those with failures and select required columns
- $VMHosts = @($VMHosts | where {($failures | Select -expandproperty VMHostID) -notcontains $_.id} | Select @{Name="VMHostProfile";Expression={$Profile.Name}}, @{Name="Host";Expression={$_.Name}}, @{Name="Compliant";Expression={$true}}, @{Name="Failures";Expression={"None"}})
+ $VMHosts = @($VMHosts | Where-Object {($failures | Select-Object -expandproperty VMHostID) -notcontains $_.id} | Select-Object @{Name="VMHostProfile";Expression={$Profile.Name}}, @{Name="Host";Expression={$_.Name}}, @{Name="Compliant";Expression={$true}}, @{Name="Failures";Expression={"None"}})
# Add in the failures
- $VMHosts += ($Failures | Select VMHostProfile, @{Name='Host';Expression={$_.vmhost.name}}, @{Name='Compliant';Expression={$false}}, @{Name="Failures";Expression={($_.IncomplianceElementList | Select -expandproperty Description) -join "
"}})
+ $VMHosts += ($Failures | Select-Object VMHostProfile, @{Name='Host';Expression={$_.vmhost.name}}, @{Name='Compliant';Expression={$false}}, @{Name="Failures";Expression={($_.IncomplianceElementList | Select-Object -expandproperty Description) -join "
"}})
if ($ShowCompliant) {
$VMHosts
}
else {
- $VMHosts | Where { $_.Compliant -eq $false }
+ $VMHosts | Where-Object { $_.Compliant -eq $false }
}
}
else {
# Otherwise, we don't care about the detail
- $Profile | Select Name, @{Name="Compliant";Expression={@($_ | Test-VMHostProfileCompliance -UseCache).count -eq 0 }}
+ $Profile | Select-Object Name, @{Name="Compliant";Expression={@($_ | Test-VMHostProfileCompliance -UseCache).count -eq 0 }}
}
}
else {
# Profile is not used - just return the name and "N/A"
if ($ShowCompliant) {
if ($ShowDetail) {
- $Profile | Select @{Name="VMHostProfile";Expression={$_.Name}}, @{Name="Host";Expression="None"}, @{Name="Compliant";Expression={"N/A"}}, @{Name="Failures";Expression={"N/A"}}
+ $Profile | Select-Object @{Name="VMHostProfile";Expression={$_.Name}}, @{Name="Host";Expression="None"}, @{Name="Compliant";Expression={"N/A"}}, @{Name="Failures";Expression={"N/A"}}
}
else {
- $Profile | Select Name, @{Name="Compliant";Expression="N/A"}
+ $Profile | Select-Object Name, @{Name="Compliant";Expression="N/A"}
}
}
}
diff --git a/Plugins/30 Host/110 Host Certificate Expiration Check.ps1 b/Plugins/30 Host/110 Host Certificate Expiration Check.ps1
index c983e2c4..4d95bd34 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 {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | Foreach { Test-WebServerSSL -URL $_.Name | Select 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 { 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/16 Host Swapfile datastores.ps1 b/Plugins/30 Host/16 Host Swapfile datastores.ps1
index 4823e327..57948631 100644
--- a/Plugins/30 Host/16 Host Swapfile datastores.ps1
+++ b/Plugins/30 Host/16 Host Swapfile datastores.ps1
@@ -11,7 +11,7 @@ $PluginCategory = "vSphere"
foreach ($clusview in $clusviews) {
if ($clusview.ConfigurationEx.VmSwapPlacement -eq "hostLocal") {
- $CluNodes = $VMH | where {$clusview.Host -contains $_.Id }
+ $CluNodes = $VMH | Where-Object {$clusview.Host -contains $_.Id }
foreach ($CluNode in $CluNodes) {
if ($CluNode.VMSwapfileDatastore.Name -eq $null){
if ($CluNode.ExtensionData.Config.LocalSwapDatastore.Value) {
diff --git a/Plugins/30 Host/20 ESXi with Technical Support mode enabled.ps1 b/Plugins/30 Host/20 ESXi with Technical Support mode enabled.ps1
index f23b0600..83667014 100644
--- a/Plugins/30 Host/20 ESXi with Technical Support mode enabled.ps1
+++ b/Plugins/30 Host/20 ESXi with Technical Support mode enabled.ps1
@@ -9,5 +9,5 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$VMH | Where { ($_.Version -lt 4.1) -and ($_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance") -and ($_.ExtensionData.Summary.Config.Product.Name -match "i")} | Select Name, @{N="TechSuportModeEnabled";E={($_ | Get-AdvancedSetting -Name VMkernel.Boot.techSupportMode).value}} | Where { $_.TechSuportModeEnabled -eq "True" }
-$VMH | Where { $_.Version -ge "4.1.0" } | Where {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | Select Name, @{N="TechSuportModeEnabled";E={($_ | Get-VMHostService | Where {$_.key -eq "TSM"}).Running}} | Where { $_.TechSuportModeEnabled -eq "True" }
\ No newline at end of file
+$VMH | Where-Object { ($_.Version -lt 4.1) -and ($_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance") -and ($_.ExtensionData.Summary.Config.Product.Name -match "i")} | Select-Object Name, @{N="TechSuportModeEnabled";E={($_ | Get-AdvancedSetting -Name VMkernel.Boot.techSupportMode).value}} | Where-Object { $_.TechSuportModeEnabled -eq "True" }
+$VMH | Where-Object { $_.Version -ge "4.1.0" } | Where-Object {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | Select-Object Name, @{N="TechSuportModeEnabled";E={($_ | Get-VMHostService | Where-Object {$_.key -eq "TSM"}).Running}} | Where-Object { $_.TechSuportModeEnabled -eq "True" }
\ No newline at end of file
diff --git a/Plugins/30 Host/21 ESXi hosts which do not have Lockdown mode enabled.ps1 b/Plugins/30 Host/21 ESXi hosts which do not have Lockdown mode enabled.ps1
index b0a3ff6f..13429577 100644
--- a/Plugins/30 Host/21 ESXi hosts which do not have Lockdown mode enabled.ps1
+++ b/Plugins/30 Host/21 ESXi hosts which do not have Lockdown mode enabled.ps1
@@ -9,7 +9,7 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$VMH | Where {@("Connected","Maintenance") -contains $_.ConnectionState -and
+$VMH | Where-Object {@("Connected","Maintenance") -contains $_.ConnectionState -and
$_.ExtensionData.Summary.Config.Product.Name -match "i" -and
-not $_.ExtensionData.Config.AdminDisabled} | `
- Select Name, @{N="LockedMode";E={$_.ExtensionData.Config.AdminDisabled}}
\ No newline at end of file
+ Select-Object Name, @{N="LockedMode";E={$_.ExtensionData.Config.AdminDisabled}}
\ No newline at end of file
diff --git a/Plugins/30 Host/31 NTP Name and Service.ps1 b/Plugins/30 Host/31 NTP Name and Service.ps1
index b5e2aeb3..56f7d296 100644
--- a/Plugins/30 Host/31 NTP Name and Service.ps1
+++ b/Plugins/30 Host/31 NTP Name and Service.ps1
@@ -11,4 +11,4 @@ $PluginCategory = "vSphere"
$ntpserver = "pool.ntp.org,pool2.ntp.org"
# End of Settings
-$VMH | Where {$_.Connectionstate -ne "Disconnected"} | Select Name, @{N="NTPServer";E={($_ | Get-VMHostNtpServer) -join ","}}, @{N="ServiceRunning";E={(Get-VmHostService -VMHost $_ | Where-Object {$_.key -eq "ntpd"}).Running}} | Where {$_.ServiceRunning -eq $false -or $_.NTPServer -ne $ntpserver}
\ No newline at end of file
+$VMH | Where-Object {$_.Connectionstate -ne "Disconnected"} | Select-Object Name, @{N="NTPServer";E={($_ | Get-VMHostNtpServer) -join ","}}, @{N="ServiceRunning";E={(Get-VmHostService -VMHost $_ | Where-Object {$_.key -eq "ntpd"}).Running}} | Where-Object {$_.ServiceRunning -eq $false -or $_.NTPServer -ne $ntpserver}
\ No newline at end of file
diff --git a/Plugins/30 Host/35 Host Configuration Issues.ps1 b/Plugins/30 Host/35 Host Configuration Issues.ps1
index d7b6742d..5d96bf47 100644
--- a/Plugins/30 Host/35 Host Configuration Issues.ps1
+++ b/Plugins/30 Host/35 Host Configuration Issues.ps1
@@ -22,4 +22,4 @@ foreach ($HostsView in $HostsViews) {
}
}
-$hostcialarms | sort name
\ No newline at end of file
+$hostcialarms | Sort-Object name
\ No newline at end of file
diff --git a/Plugins/30 Host/36 Host Alarms.ps1 b/Plugins/30 Host/36 Host Alarms.ps1
index a8885ba4..b8de902e 100644
--- a/Plugins/30 Host/36 Host Alarms.ps1
+++ b/Plugins/30 Host/36 Host Alarms.ps1
@@ -9,14 +9,14 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-foreach ($HostsView in ($HostsViews | Where {$_.TriggeredAlarmState} | Sort-Object Name)){
+foreach ($HostsView in ($HostsViews | Where-Object {$_.TriggeredAlarmState} | Sort-Object Name)){
Foreach ($hostsTriggeredAlarm in $HostsView.TriggeredAlarmState){
New-Object PSObject -Property @{
"Object" = $HostsView.name;
- "Alarm" = ($valarms | Where {$_.value -eq ($hostsTriggeredAlarm.alarm.value)}).name;
+ "Alarm" = ($valarms | Where-Object {$_.value -eq ($hostsTriggeredAlarm.alarm.value)}).name;
"Status" = $hostsTriggeredAlarm.OverallStatus;
"Time" = $hostsTriggeredAlarm.time.ToLocalTime()
- } | Select Object, Alarm, Status, Time
+ } | Select-Object Object, Alarm, Status, Time
}
}
diff --git a/Plugins/30 Host/44 VMKernel Warnings.ps1 b/Plugins/30 Host/44 VMKernel Warnings.ps1
index 5d1369e9..20e92f8e 100644
--- a/Plugins/30 Host/44 VMKernel Warnings.ps1
+++ b/Plugins/30 Host/44 VMKernel Warnings.ps1
@@ -18,7 +18,7 @@ $VMKernelWarnings = @()
foreach ($VMHost in ($HostsViews)){
$product = $VMHost.config.product.ProductLineId
if ($product -eq "embeddedEsx" -and $VIVersion -lt 5){
- $Warnings = (Get-Log -vmhost ($VMHost.name) -Key messages -ErrorAction SilentlyContinue).entries |where {$_ -match "warning" -and $_ -match "vmkernel"}
+ $Warnings = (Get-Log -vmhost ($VMHost.name) -Key messages -ErrorAction SilentlyContinue).entries | Where-Object {$_ -match "warning" -and $_ -match "vmkernel"}
if ($Warnings -ne $null) {
$VMKernelWarning = @()
$Warnings | % {
@@ -36,10 +36,10 @@ foreach ($VMHost in ($HostsViews)){
}
$VMKernelWarning += $Details
}
- $VMKernelWarnings += $VMKernelWarning | Sort-Object -Property Length -Unique |select VMHost, Message, KBSearch, Google
+ $VMKernelWarnings += $VMKernelWarning | Sort-Object -Property Length -Unique | Select-Object VMHost, Message, KBSearch, Google
}
} else {
- $Warnings = (Get-Log -VMHost ($VMHost.Name) -Key vmkernel -ErrorAction SilentlyContinue).Entries | where {$_ -match "warning"}
+ $Warnings = (Get-Log -VMHost ($VMHost.Name) -Key vmkernel -ErrorAction SilentlyContinue).Entries | Where-Object {$_ -match "warning"}
if ($Warnings -ne $null) {
$VMKernelWarning = @()
$Warnings | Foreach {
@@ -57,9 +57,9 @@ foreach ($VMHost in ($HostsViews)){
}
$VMKernelWarning += $Details
}
- $VMKernelWarnings += $VMKernelWarning | Sort-Object -Property Length -Unique |select VMHost, Message, KBSearch, Google
+ $VMKernelWarnings += $VMKernelWarning | Sort-Object -Property Length -Unique | Select-Object VMHost, Message, KBSearch, Google
}
}
}
-$VMKernelWarnings | sort Message -Descending
\ No newline at end of file
+$VMKernelWarnings | Sort-Object Message -Descending
\ No newline at end of file
diff --git a/Plugins/30 Host/46 Missing ESX patches.ps1 b/Plugins/30 Host/46 Missing ESX patches.ps1
index 6ce51efc..43417622 100644
--- a/Plugins/30 Host/46 Missing ESX patches.ps1
+++ b/Plugins/30 Host/46 Missing ESX patches.ps1
@@ -15,9 +15,9 @@ $PluginCategory = "vSphere"
If (Get-PSSnapin Vmware.VumAutomation -ErrorAction SilentlyContinue) {
foreach($esx in $VMH){
- foreach($baseline in (Get-Compliance -Entity $esx -Detailed | where {$_.Status -eq "NotCompliant"})){
+ foreach($baseline in (Get-Compliance -Entity $esx -Detailed | Where-Object {$_.Status -eq "NotCompliant"})){
$baseline.NotCompliantPatches |
- select @{N="Host";E={$esx.Name}},
+ Select-Object @{N="Host";E={$esx.Name}},
@{N="Baseline";E={$baseline.Baseline.Name}},Name,ReleaseDate,IdByVendor,
@{N="KB";E={(Select-String "(?http://[\w|\.|/]*\w{1})" -InputObject $_.Description).Matches[0].Groups['url'].Value}}
}
diff --git a/Plugins/30 Host/53 Hardware status warnings-errors.ps1 b/Plugins/30 Host/53 Hardware status warnings-errors.ps1
index a89402e4..a4783bbf 100644
--- a/Plugins/30 Host/53 Hardware status warnings-errors.ps1
+++ b/Plugins/30 Host/53 Hardware status warnings-errors.ps1
@@ -14,8 +14,8 @@ foreach ($HostsView in ($HostsViews|?{$_.runtime.connectionstate -eq "Connected"
$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 @{N="sensor";E={$_.name}},@{N="status";E={$_.status.key}}
- $HealthStatusDetails = ($HealthStatus.SystemHealthInfo).NumericSensorInfo|?{$_.HealthState.key -inotmatch "green" -band $_.HealthState.key -inotmatch "unknown"}|select @{N="sensor";E={$_.name}},@{N="status";E={$_.HealthState.key}}
+ $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}}
if ($HWStatusDetails) {
foreach ($HWStatusDetail in $HWStatusDetails) {
New-Object PSObject -Property @{
diff --git a/Plugins/30 Host/67 Host OS Pivot Table.ps1 b/Plugins/30 Host/67 Host OS Pivot Table.ps1
index 98c239af..f41ed2d5 100644
--- a/Plugins/30 Host/67 Host OS Pivot Table.ps1
+++ b/Plugins/30 Host/67 Host OS Pivot Table.ps1
@@ -10,4 +10,4 @@ $PluginCategory = "vSphere"
# End of Settings
$HostsViews | Group-Object {$_.Summary.config.product.fullname} | `
- Select @{Name="Version";Expression={$_.Name}}, Count | Sort-Object Count -Descending
\ No newline at end of file
+ Select-Object @{Name="Version";Expression={$_.Name}}, Count | Sort-Object Count -Descending
\ No newline at end of file
diff --git a/Plugins/30 Host/68 Disk Max Total Latency.ps1 b/Plugins/30 Host/68 Disk Max Total Latency.ps1
index ed579874..d41bb2c1 100644
--- a/Plugins/30 Host/68 Disk Max Total Latency.ps1
+++ b/Plugins/30 Host/68 Disk Max Total Latency.ps1
@@ -19,7 +19,7 @@ $HostsDiskLatency = @()
foreach ($VMHost in $VMH | ?{$_.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 Timestamp -Descending
+ $VHHMaxLatency = $VMHost | get-stat -stat "disk.maxTotalLatency.latest" -start ($Date).addhours(-$stattotallatency) -finish ($Date)|?{$_.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/74 Host - Network Redundancy lost.ps1 b/Plugins/30 Host/74 Host - Network Redundancy lost.ps1
index ff0c3f54..a05a7232 100644
--- a/Plugins/30 Host/74 Host - Network Redundancy lost.ps1
+++ b/Plugins/30 Host/74 Host - Network Redundancy lost.ps1
@@ -12,7 +12,7 @@ $PluginCategory = "vSphere"
$vsList = Get-VirtualSwitch
foreach ($VMHost in $VMH) {
foreach($pnic in $VMHost.ExtensionData.Config.Network.Pnic){
- $vSw = $vsList | where {($_.VMHost -eq $VMHost) -and ($_.Nic -contains $pNic.Device)}
- $pnic | Select @{N="ESXname";E={$VMHost.Name}},@{N="pNic";E={$pnic.Device}},@{N="vSwitch";E={$vSw.Name}},@{N="Status";E={if($pnic.LinkSpeed -ne $null){"up"}else{"down"}}} | Where {$_.Status -eq "down"}
+ $vSw = $vsList | Where-Object {($_.VMHost -eq $VMHost) -and ($_.Nic -contains $pNic.Device)}
+ $pnic | Select-Object @{N="ESXname";E={$VMHost.Name}},@{N="pNic";E={$pnic.Device}},@{N="vSwitch";E={$vSw.Name}},@{N="Status";E={if($pnic.LinkSpeed -ne $null){"up"}else{"down"}}} | Where-Object {$_.Status -eq "down"}
}
}
\ No newline at end of file
diff --git a/Plugins/30 Host/81 LUN Paths Check.ps1 b/Plugins/30 Host/81 LUN Paths Check.ps1
index 99e6deee..3d8f56f3 100644
--- a/Plugins/30 Host/81 LUN Paths Check.ps1
+++ b/Plugins/30 Host/81 LUN Paths Check.ps1
@@ -14,7 +14,7 @@ $RecLUNPaths = 2
$RecLUNPaths = Get-vCheckSetting $Title "RecLUNPaths" $RecLUNPaths
$missingpaths = @()
-foreach ($esxhost in ($HostsViews | where {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
+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.*"} | %{
diff --git a/Plugins/40 Datastore/109 Orphaned VMDK File.ps1.disabled b/Plugins/40 Datastore/109 Orphaned VMDK File.ps1.disabled
index d4210d7b..658d0d84 100644
--- a/Plugins/40 Datastore/109 Orphaned VMDK File.ps1.disabled
+++ b/Plugins/40 Datastore/109 Orphaned VMDK File.ps1.disabled
@@ -49,7 +49,7 @@ $report = @()
$arrUsedDisks = $FullVM | % {$_.Layout} | % {$_.Disk} | % {$_.DiskFile}
#Write-CustomOut "..filtering list to exclude datastores that match this regex pattern: $excludeDatastoreRegex"
-$arrDS = $storageviews | Sort-Object -property Name | Where {$_.name -notmatch $excludeDatastoreRegex }
+$arrDS = $storageviews | Sort-Object -property Name | Where-Object {$_.name -notmatch $excludeDatastoreRegex }
foreach ($strDatastore in $arrDS) {
# Write-CustomOut "..$($strDatastore.Name) Orphaned Disks:"
diff --git a/Plugins/40 Datastore/115 Datastore Clusters with sDRS Disabled.ps1 b/Plugins/40 Datastore/115 Datastore Clusters with sDRS Disabled.ps1
index 2dc1848f..dd1229c5 100644
--- a/Plugins/40 Datastore/115 Datastore Clusters with sDRS Disabled.ps1
+++ b/Plugins/40 Datastore/115 Datastore Clusters with sDRS Disabled.ps1
@@ -10,8 +10,8 @@ $PluginCategory = "vSphere"
# End of Settings
$DatastoreClustersView | `
- Where {$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Enabled -ne $true -or $_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.DefaultVmBehavior -ne "automated"} | `
- Select Name, @{N="sDRS Enabled";E={$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Enabled}}, @{N="sDRS Automation Level";E={$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.DefaultVmBehavior}}
+ Where-Object {$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Enabled -ne $true -or $_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.DefaultVmBehavior -ne "automated"} | `
+ Select-Object Name, @{N="sDRS Enabled";E={$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Enabled}}, @{N="sDRS Automation Level";E={$_.PodStorageDrsEntry.StorageDrsConfig.PodConfig.DefaultVmBehavior}}
# Changelog
## 1.0 : Initial Version
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 167ea1e8..87f82a40 100644
--- a/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1
+++ b/Plugins/40 Datastore/116 sDRS VM Behavior not Default.ps1
@@ -15,8 +15,8 @@ $ExcludedVMs = ""
$ExcludedVMs = Get-vCheckSetting $Title "ExcludedVMs" $ExcludedVMs
$DatastoreClustersView | Foreach {$_.PodStorageDrsEntry.StorageDrsConfig.VMConfig} | `
- Where {$_.Enabled -eq $false -or $_.Behavior -ne $null} | `
- Select @{N="VM";E={Get-View $_.Vm | Select -ExpandProperty Name}}, Enabled, Behavior,@{N="Datastore Cluster";E={$dc.Name}} | Where { $_.VM -notmatch $ExcludedVMs }
+ 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 }
# Changelog
## 1.0 : Initial Version
diff --git a/Plugins/40 Datastore/34 Number of VMs per Datastore.ps1 b/Plugins/40 Datastore/34 Number of VMs per Datastore.ps1
index 3e91b9a8..33988d9b 100644
--- a/Plugins/40 Datastore/34 Number of VMs per Datastore.ps1
+++ b/Plugins/40 Datastore/34 Number of VMs per Datastore.ps1
@@ -16,7 +16,7 @@ $ExcludedDatastores = "ExcludeMe"
$NumVMsPerDatastore = Get-vCheckSetting $Title "NumVMsPerDatastore" $NumVMsPerDatastore
$ExcludedDatastores = Get-vCheckSetting $Title "ExcludedDatastores" $ExcludedDatastores
-$StorageViews | Where-Object { $_.Name -notmatch $ExcludedDatastores } | Select Name, @{N="NumVM";E={($_.vm).Count}} | Where { $_.NumVM -gt $NumVMsPerDatastore} | Sort NumVM -Descending
+$StorageViews | Where-Object { $_.Name -notmatch $ExcludedDatastores } | Select-Object Name, @{N="NumVM";E={($_.vm).Count}} | Where-Object { $_.NumVM -gt $NumVMsPerDatastore} | Sort-Object NumVM -Descending
$Header = "Number of VMs per Datastore over $($NumVMsPerDatastore) : [count]"
diff --git a/Plugins/40 Datastore/69 Datastores in Maintenance mode.ps1 b/Plugins/40 Datastore/69 Datastores in Maintenance mode.ps1
index 615aab22..b2f9fee8 100644
--- a/Plugins/40 Datastore/69 Datastores in Maintenance mode.ps1
+++ b/Plugins/40 Datastore/69 Datastores in Maintenance mode.ps1
@@ -10,7 +10,7 @@ $PluginCategory = "vSphere"
# End of Settings
if ($VIVersion -ge 5) {
- $StorageViews | Where {$_.Summary.MaintenanceMode -match "inMaintenance"} | Select Name, @{N="MaintenanceMode";E={$_.Summary.MaintenanceMode}}
+ $StorageViews | Where-Object {$_.Summary.MaintenanceMode -match "inMaintenance"} | Select-Object Name, @{N="MaintenanceMode";E={$_.Summary.MaintenanceMode}}
}
# Change Log
diff --git a/Plugins/40 Datastore/70 Datastores with Alarms Disabled.ps1 b/Plugins/40 Datastore/70 Datastores with Alarms Disabled.ps1
index 33748312..a0153759 100644
--- a/Plugins/40 Datastore/70 Datastores with Alarms Disabled.ps1
+++ b/Plugins/40 Datastore/70 Datastores with Alarms Disabled.ps1
@@ -9,7 +9,7 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$Datastores | where {!$_.ExtensionData.AlarmActionsEnabled} | Select Name, @{n='AlarmActionsEnabled'; e={$_.ExtensionData.AlarmActionsEnabled}}
+$Datastores | Where-Object {!$_.ExtensionData.AlarmActionsEnabled} | Select-Object Name, @{n='AlarmActionsEnabled'; e={$_.ExtensionData.AlarmActionsEnabled}}
# Change Log
## 1.0 : Initial version
diff --git a/Plugins/50 Network/24 vSwitch with less than x Ports Free.ps1 b/Plugins/50 Network/24 vSwitch with less than x Ports Free.ps1
index 4af48f90..6e9dbe74 100644
--- a/Plugins/50 Network/24 vSwitch with less than x Ports Free.ps1
+++ b/Plugins/50 Network/24 vSwitch with less than x Ports Free.ps1
@@ -12,7 +12,7 @@ $vSwitchLeft = 5
# Update settings where there is an override
$vSwitchLeft = Get-vCheckSetting $Title "vSwitchLeft" $vSwitchLeft
-$VMH | Get-VirtualSwitch -Standard | Sort NumPortsAvailable | Where {$_.NumPortsAvailable -lt $($vSwitchLeft)} | Select VMHost, Name, NumPortsAvailable
+$VMH | Get-VirtualSwitch -Standard | Sort-Object NumPortsAvailable | Where-Object {$_.NumPortsAvailable -lt $($vSwitchLeft)} | Select-Object VMHost, Name, NumPortsAvailable
$Header = "Standard vSwitch with less than $vSwitchLeft Port(s) Free: [count]"
$Comments = "The following standard vSwitches have less than $vSwitchLeft left"
\ No newline at end of file
diff --git a/Plugins/50 Network/98 vSwitch Security.ps1 b/Plugins/50 Network/98 vSwitch Security.ps1
index 4c30ccf2..59649ed5 100644
--- a/Plugins/50 Network/98 vSwitch Security.ps1
+++ b/Plugins/50 Network/98 vSwitch Security.ps1
@@ -90,7 +90,7 @@ if ($VersionOK) {
}
}
- if ($results.Host) { $results | where { ($_.AllowPromiscuous -eq $AllowPromiscuousPolicy) -or ($_.ForgedTransmits -eq $ForgedTransmitsPolicy) -or ($_.MacChanges -eq $MacChangesPolicy) } | Sort-Object vSwitch,PortGroup }
+ if ($results.Host) { $results | Where-Object { ($_.AllowPromiscuous -eq $AllowPromiscuousPolicy) -or ($_.ForgedTransmits -eq $ForgedTransmitsPolicy) -or ($_.MacChanges -eq $MacChangesPolicy) } | Sort-Object vSwitch,PortGroup }
}
else {
Write-Warning "PowerCLi version installed is lower than 5.1 Release 2"
diff --git a/Plugins/60 VM/02 Snapshot Information.ps1 b/Plugins/60 VM/02 Snapshot Information.ps1
index a0b23eff..041469ff 100644
--- a/Plugins/60 VM/02 Snapshot Information.ps1
+++ b/Plugins/60 VM/02 Snapshot Information.ps1
@@ -32,7 +32,7 @@ function Get-SnapshotSummary {
$mySnaps += $SnapshotInfo
}
- $mySnaps | Select VM, @{N="SnapName";E={[System.Web.HttpUtility]::UrlDecode($_.Name)}}, @{N="DaysOld";E={((Get-Date) - $_.Created).Days}}, Creator, @{N="SizeGB";E={$_.SizeGB -as [int]}}, Created, Description -ErrorAction SilentlyContinue | Sort DaysOld
+ $mySnaps | Select-Object VM, @{N="SnapName";E={[System.Web.HttpUtility]::UrlDecode($_.Name)}}, @{N="DaysOld";E={((Get-Date) - $_.Created).Days}}, Creator, @{N="SizeGB";E={$_.SizeGB -as [int]}}, Created, Description -ErrorAction SilentlyContinue | Sort-Object DaysOld
} else {
throw 'ParameterBinderStrings\InputObjectNotBound'
@@ -79,7 +79,7 @@ function Get-SnapshotExtra ($snap){
$dummy = $collectionImpl.RewindCollector
$collection = $collectionImpl.ReadNextTasks($tasknumber)
while($collection -ne $null){
- $collection | where {$_.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} | %{
$row = New-Object PsObject
$row | Add-Member -MemberType NoteProperty -Name User -Value $_.Reason.UserName
$vm = Get-View $_.Entity
@@ -107,7 +107,7 @@ function Get-SnapshotExtra ($snap){
$snapshotsExtra
}
-$VM | Get-Snapshot | Where {$_.Created -lt (($Date).AddDays(-$SnapshotAge))} | Get-SnapshotSummary | Where {$_.SnapName -notmatch $excludeName -and $_.Description -notmatch $excludeDesc -and $_.Creator -notmatch $excludeCreator}
+$VM | Get-Snapshot | Where-Object {$_.Created -lt (($Date).AddDays(-$SnapshotAge))} | Get-SnapshotSummary | Where-Object {$_.SnapName -notmatch $excludeName -and $_.Description -notmatch $excludeDesc -and $_.Creator -notmatch $excludeCreator}
$Title = "Snapshot Information"
$Header = "Snapshots (Over $SnapshotAge Days Old): [count]"
diff --git a/Plugins/60 VM/04 Map disk region event.ps1 b/Plugins/60 VM/04 Map disk region event.ps1
index 5974b3f9..b195dfad 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 {$_.FullFormattedMessage -match "Map disk region"} | Foreach {$_.vm}|select name |Sort-Object -unique
+Get-VIEventPlus -Start ($Date).AddDays(-$eventAge) -Type Info | Where-Object {$_.FullFormattedMessage -match "Map disk region"} | Foreach {$_.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/09 Created or cloned VMs.ps1 b/Plugins/60 VM/09 Created or cloned VMs.ps1
index ca8701f4..7ad1fa9b 100644
--- a/Plugins/60 VM/09 Created or cloned VMs.ps1
+++ b/Plugins/60 VM/09 Created or cloned VMs.ps1
@@ -12,7 +12,7 @@ $VMsNewRemovedAge = 5
# Update settings where there is an override
$VMsNewRemovedAge = Get-vCheckSetting $Title "VMsNewRemovedAge" $VMsNewRemovedAge
-Get-VIEventPlus -Start ((get-date).adddays(-$VMsNewRemovedAge)) -EventType @("VmCreatedEvent", "VmBeingClonedEvent", "VmBeingDeployedEvent") | Select createdTime, UserName, fullFormattedMessage
+Get-VIEventPlus -Start ((get-date).adddays(-$VMsNewRemovedAge)) -EventType @("VmCreatedEvent", "VmBeingClonedEvent", "VmBeingDeployedEvent") | Select-Object createdTime, UserName, fullFormattedMessage
$Header = ("VMs Created or Cloned (Last {0} Day(s)): [count])" -f $VMsNewRemovedAge)
$Comments = ("The following VMs have been created over the last {0} Days" -f $VMsNewRemovedAge)
diff --git a/Plugins/60 VM/10 Removed VMs.ps1 b/Plugins/60 VM/10 Removed VMs.ps1
index d44c30f4..c064e553 100644
--- a/Plugins/60 VM/10 Removed VMs.ps1
+++ b/Plugins/60 VM/10 Removed VMs.ps1
@@ -12,7 +12,7 @@ $VMsNewRemovedAge = 5
# Update settings where there is an override
$VMsNewRemovedAge = Get-vCheckSetting $Title "VMsNewRemovedAge" $VMsNewRemovedAge
-Get-VIEventPlus -Start ((get-date).adddays(-$VMsNewRemovedAge)) -EventType "VmRemovedEvent" | Select @{Name="VMName";Expression={$_.vm.name}}, CreatedTime, UserName, fullFormattedMessage
+Get-VIEventPlus -Start ((get-date).adddays(-$VMsNewRemovedAge)) -EventType "VmRemovedEvent" | Select-Object @{Name="VMName";Expression={$_.vm.name}}, CreatedTime, UserName, fullFormattedMessage
$Header = ("VMs Removed (Last {0} Day(s)): [count]" -f $VMsNewRemovedAge)
$Comments = "The following VMs have been removed/deleted over the last {0} days" -f $VMsNewRemovedAge
diff --git a/Plugins/60 VM/100 VMs with CPU or Memory Reservations.ps1 b/Plugins/60 VM/100 VMs with CPU or Memory Reservations.ps1
index 33daeeec..932c6d13 100644
--- a/Plugins/60 VM/100 VMs with CPU or Memory Reservations.ps1
+++ b/Plugins/60 VM/100 VMs with CPU or Memory Reservations.ps1
@@ -14,7 +14,7 @@ $MCRDoNotInclude = ""
# Update settings where there is an override
$MCRDoNotInclude = Get-vCheckSetting $Title "MCRDoNotInclude" $MCRDoNotInclude
-$FullVM | Where {$_.Name -notmatch $MCRDoNotInclude -and ($_.config.cpuallocation.Reservation -ne "0" -or $_.config.memoryallocation.Reservation -ne "0")} | Select Name, @{Name="CPUReservationMhz";E={$_.config.cpuallocation.Reservation}}, @{Name="MemReservationMB";E={$_.config.memoryallocation.Reservation}}
+$FullVM | Where-Object {$_.Name -notmatch $MCRDoNotInclude -and ($_.config.cpuallocation.Reservation -ne "0" -or $_.config.memoryallocation.Reservation -ne "0")} | Select-Object Name, @{Name="CPUReservationMhz";E={$_.config.cpuallocation.Reservation}}, @{Name="MemReservationMB";E={$_.config.memoryallocation.Reservation}}
# Change Log
## 1.0 : Initial Release
diff --git a/Plugins/60 VM/102 VM Logging.ps1 b/Plugins/60 VM/102 VM Logging.ps1
index 3defe322..55832a03 100644
--- a/Plugins/60 VM/102 VM Logging.ps1
+++ b/Plugins/60 VM/102 VM Logging.ps1
@@ -17,8 +17,8 @@ $KeepOld = Get-vCheckSetting $Title "KeepOld" $KeepOld
$RotateSize = Get-vCheckSetting $Title "RotateSize" $RotateSize
$VM | Foreach {
- $VMKeepOld = $_.ExtensionData.Config.ExtraConfig | Where {$_.Key -eq "log.keepold"} | Select -ExpandProperty Value
- $VMRotateSize = $_.ExtensionData.Config.ExtraConfig | Where {$_.Key -eq "log.rotatesize"} | Select -ExpandProperty Value
+ $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
If ($VMKeepOld -ne $KeepOld -Or $VMRotateSize -ne $RotateSize) {
New-Object -TypeName PSObject -Property @{
diff --git a/Plugins/60 VM/106 Find Phantom Snapshots.ps1 b/Plugins/60 VM/106 Find Phantom Snapshots.ps1
index 07a4b0e6..8cb15129 100644
--- a/Plugins/60 VM/106 Find Phantom Snapshots.ps1
+++ b/Plugins/60 VM/106 Find Phantom Snapshots.ps1
@@ -12,7 +12,7 @@ $PluginCategory = "vSphere"
$OutputPhantomSnapshots = @()
ForEach ($theVM in $VM){
- ForEach ($theVMdisk in ($theVM | Get-HardDisk | Where {$_.Filename -match "-\d{6}.vmdk"})){
+ ForEach ($theVMdisk in ($theVM | Get-HardDisk | Where-Object {$_.Filename -match "-\d{6}.vmdk"})){
# Find VM's which don't have normal Snapshots registered
if (!(Get-Snapshot $theVM))
{
diff --git a/Plugins/60 VM/11 VMs with over CPU Count.ps1 b/Plugins/60 VM/11 VMs with over CPU Count.ps1
index ece26d45..7dea66d1 100644
--- a/Plugins/60 VM/11 VMs with over CPU Count.ps1
+++ b/Plugins/60 VM/11 VMs with over CPU Count.ps1
@@ -12,7 +12,7 @@ $vCPU = 2
# Update settings where there is an override
$vCPU = Get-vCheckSetting $Title "vCPU" $vCPU
-$VM | Where {$_.NumCPU -gt $vCPU} | Select Name, PowerState, NumCPU
+$VM | Where-Object {$_.NumCPU -gt $vCPU} | Select-Object Name, PowerState, NumCPU
$Header = ("VMs with over {0} vCPUs: [count]" -f $vCPU)
$Comments = ("The following VMs have over {0} CPU(s) and may impact performance due to CPU scheduling" -f $vCPU)
diff --git a/Plugins/60 VM/114 VM Tools Not Up to Date.ps1 b/Plugins/60 VM/114 VM Tools Not Up to Date.ps1
index e2daad98..388ab5e3 100644
--- a/Plugins/60 VM/114 VM Tools Not Up to Date.ps1
+++ b/Plugins/60 VM/114 VM Tools Not Up to Date.ps1
@@ -16,8 +16,8 @@ $VMTMaxReturn = 30
$VMTDoNotInclude = Get-vCheckSetting $Title "VMTDoNotInclude" $VMTDoNotInclude
$VMTMaxReturn = Get-vCheckSetting $Title "VMTMaxReturn" $VMTMaxReturn
-$FullVM | Where {$_.Name -notmatch $VMTDoNotInclude -and ($_.Runtime.Powerstate -eq "poweredOn" -And $_.Guest.toolsStatus -eq "toolsOld")} | `
- Select Name, @{N="Version";E={$_.Guest.ToolsVersion}}, @{N="Status";E={$_.Guest.ToolsStatus}} | Sort Name | Select -First $VMTMaxReturn
+$FullVM | Where-Object {$_.Name -notmatch $VMTDoNotInclude -and ($_.Runtime.Powerstate -eq "poweredOn" -And $_.Guest.toolsStatus -eq "toolsOld")} | `
+ Select-Object Name, @{N="Version";E={$_.Guest.ToolsVersion}}, @{N="Status";E={$_.Guest.ToolsStatus}} | Sort-Object Name | Select-Object -First $VMTMaxReturn
$Comments = ("The following VMs are running an older version of Tools than is available on its Host (Max Shown: {0} Exceptions: {1})" -f $VMTMaxReturn, $VMTDoNotInclude)
diff --git a/Plugins/60 VM/12 VMs Swapping or Ballooning.ps1 b/Plugins/60 VM/12 VMs Swapping or Ballooning.ps1
index bf8c10b3..6b10fd96 100644
--- a/Plugins/60 VM/12 VMs Swapping or Ballooning.ps1
+++ b/Plugins/60 VM/12 VMs Swapping or Ballooning.ps1
@@ -9,7 +9,7 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$FullVM | Where {$_.runtime.PowerState -eq "PoweredOn" -and ($_.Summary.QuickStats.SwappedMemory -gt 0 -or $_.Summary.QuickStats.BalloonedMemory -gt 0)} | Select Name, @{N="SwapMB";E={$_.Summary.QuickStats.SwappedMemory}}, @{N="MemBalloonMB";E={$_.Summary.QuickStats.BalloonedMemory}}
+$FullVM | Where-Object {$_.runtime.PowerState -eq "PoweredOn" -and ($_.Summary.QuickStats.SwappedMemory -gt 0 -or $_.Summary.QuickStats.BalloonedMemory -gt 0)} | Select-Object Name, @{N="SwapMB";E={$_.Summary.QuickStats.SwappedMemory}}, @{N="MemBalloonMB";E={$_.Summary.QuickStats.BalloonedMemory}}
# Changelog
## 1.1 : Using quick stats property in order to avoid using Get-Stat cmdlet for performance matter
diff --git a/Plugins/60 VM/120 Multi-writer.ps1 b/Plugins/60 VM/120 Multi-writer.ps1
index b888b064..d6c7c297 100644
--- a/Plugins/60 VM/120 Multi-writer.ps1
+++ b/Plugins/60 VM/120 Multi-writer.ps1
@@ -11,8 +11,8 @@ $PluginCategory = "vSphere"
# Multi-writer parameter
ForEach ($mwvm in $FullVM){
- $mwvm.Config.ExtraConfig | Where {$_.Key -like "scsi*sharing"} |
- Select @{N="VM";E={$mwvm.Name}},Key,Value
+ $mwvm.Config.ExtraConfig | Where-Object {$_.Key -like "scsi*sharing"} |
+ Select-Object @{N="VM";E={$mwvm.Name}},Key,Value
}
# Changelog
diff --git a/Plugins/60 VM/121 BusSharingMode - Physical and Virtual.ps1 b/Plugins/60 VM/121 BusSharingMode - Physical and Virtual.ps1
index b192bb38..493aa7de 100644
--- a/Plugins/60 VM/121 BusSharingMode - Physical and Virtual.ps1
+++ b/Plugins/60 VM/121 BusSharingMode - Physical and Virtual.ps1
@@ -11,9 +11,9 @@ $PluginCategory = "vSphere"
# BusSharingMode - Physical and Virtual
ForEach ($vm in $FullVM){
- $scsi = $vm.Config.Hardware.Device | where {$_ -is [VMware.Vim.VirtualSCSIController] -and ($_.SharedBus -eq "physicalSharing" -or $_.SharedBus -eq "virtualSharing")}
+ $scsi = $vm.Config.Hardware.Device | Where-Object {$_ -is [VMware.Vim.VirtualSCSIController] -and ($_.SharedBus -eq "physicalSharing" -or $_.SharedBus -eq "virtualSharing")}
if ($scsi){
- $scsi | Select @{N="VM";E={$vm.Name}},
+ $scsi | Select-Object @{N="VM";E={$vm.Name}},
@{N="Controller";E={$_.DeviceInfo.Label}},
@{N="BusSharingMode";E={$_.SharedBus}}
}
diff --git a/Plugins/60 VM/122 NonPersistent Disks.ps1 b/Plugins/60 VM/122 NonPersistent Disks.ps1
index e5f2466a..61c987b1 100644
--- a/Plugins/60 VM/122 NonPersistent Disks.ps1
+++ b/Plugins/60 VM/122 NonPersistent Disks.ps1
@@ -16,10 +16,10 @@ $NPExcludeVM = Get-vCheckSetting $Title "NPExcludeVM" $NPExcludeVM
# NonPersistent Disks
$diskModes = [VMware.Vim.VirtualDiskMode]::independent_nonpersistent,[VMware.Vim.VirtualDiskMode]::nonpersistent
-ForEach($npvm in $FullVM | Where {$_.Name -notmatch $NPExcludeVM}){
+ForEach($npvm in $FullVM | Where-Object {$_.Name -notmatch $NPExcludeVM}){
$npvm.Config.Hardware.Device |
- Where {$_ -is [VMware.Vim.VirtualDisk] -and $diskModes -contains $_.Backing.DiskMode} |
- Select @{N="VM";E={$npvm.Name}},
+ Where-Object {$_ -is [VMware.Vim.VirtualDisk] -and $diskModes -contains $_.Backing.DiskMode} |
+ Select-Object @{N="VM";E={$npvm.Name}},
@{N="Disk";E={$_.DeviceInfo.Label}},
@{N="Mode";E={$_.Backing.DiskMode}},
@{N="CapacityGB";E={$_.capacityInKB/1MB}},
diff --git a/Plugins/60 VM/13 Invalid or inaccessible VMs.ps1 b/Plugins/60 VM/13 Invalid or inaccessible VMs.ps1
index 12ede159..83e24ddd 100644
--- a/Plugins/60 VM/13 Invalid or inaccessible VMs.ps1
+++ b/Plugins/60 VM/13 Invalid or inaccessible VMs.ps1
@@ -9,5 +9,5 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$FullVM | Where {$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} | Sort Name | `
- Select Name, @{Name="ConnectionState";e={$_.Runtime.ConnectionState}}, @{Name="PowerState";e={$_.Runtime.PowerState}}, @{Name="IP_Address";e={$_.Guest.IpAddress}}
\ No newline at end of file
+$FullVM | Where-Object {$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} | Sort-Object Name | `
+ Select-Object Name, @{Name="ConnectionState";e={$_.Runtime.ConnectionState}}, @{Name="PowerState";e={$_.Runtime.PowerState}}, @{Name="IP_Address";e={$_.Guest.IpAddress}}
\ No newline at end of file
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 4bfb5d30..6cd95043 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 CreatedTime,FullFormattedMessage | sort CreatedTime -Descending
+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
$Comments = ("The following VMs have been restarted by HA in the last {0} days" -f $HAVMresetold)
diff --git a/Plugins/60 VM/19 Guests with less than X MB free.ps1 b/Plugins/60 VM/19 Guests with less than X MB free.ps1
index 36a3f580..7b6e073c 100644
--- a/Plugins/60 VM/19 Guests with less than X MB free.ps1
+++ b/Plugins/60 VM/19 Guests with less than X MB free.ps1
@@ -16,7 +16,7 @@ $MBFree = Get-vCheckSetting $Title "MBFree" $MBFree
$MBDiskMinSize = Get-vCheckSetting $Title "MBDiskMinSize" $MBDiskMinSize
$MyCollection = @()
-$AllVMs = $FullVM | Where {-not $_.Config.Template } | Where { $_.Runtime.PowerState -eq "poweredOn" -And ($_.Guest.toolsStatus -ne "toolsNotInstalled" -And $_.Guest.ToolsStatus -ne "toolsNotRunning")} | Select *, @{N="NumDisks";E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks
+$AllVMs = $FullVM | Where-Object {-not $_.Config.Template -and $_.Runtime.PowerState -eq "poweredOn" -And ($_.Guest.toolsStatus -ne "toolsNotInstalled" -And $_.Guest.ToolsStatus -ne "toolsNotRunning")} | Select-Object *, @{N="NumDisks";E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks
ForEach ($VMdsk in $AllVMs){
Foreach ($disk in $VMdsk.Guest.Disk){
if ((([math]::Round($disk.Capacity / 1MB)) -gt $MBDiskMinSize) -and (([math]::Round($disk.FreeSpace / 1MB)) -lt $MBFree)){
diff --git a/Plugins/60 VM/200 VMs on ephemeral portgroup.ps1 b/Plugins/60 VM/200 VMs on ephemeral portgroup.ps1
index 9eef25d4..1bf2c2d4 100644
--- a/Plugins/60 VM/200 VMs on ephemeral portgroup.ps1
+++ b/Plugins/60 VM/200 VMs on ephemeral portgroup.ps1
@@ -9,5 +9,5 @@ $PluginCategory = "vSphere"
# Start of Settings
# End of Settings
-$EphemeralPG = Get-VDSwitch | Get-VDPortgroup | where {$_.PortBinding -eq "Ephemeral"}
-$VM | Get-NetworkAdapter | where {$_.NetworkName -contains $EphemeralPG} | Select @{Name="VMName"; Expression={$_.parent}}, @{Name="Portgroup"; Expression={$_.NetworkName}}
\ No newline at end of file
+$EphemeralPG = Get-VDSwitch | Get-VDPortgroup | Where-Object {$_.PortBinding -eq "Ephemeral"}
+$VM | Get-NetworkAdapter | Where-Object {$_.NetworkName -contains $EphemeralPG} | Select-Object @{Name="VMName"; Expression={$_.parent}}, @{Name="Portgroup"; Expression={$_.NetworkName}}
\ No newline at end of file
diff --git a/Plugins/60 VM/201 VMs Hot Add Configuration.ps1 b/Plugins/60 VM/201 VMs Hot Add Configuration.ps1
index df158a0f..a0c89140 100644
--- a/Plugins/60 VM/201 VMs Hot Add Configuration.ps1
+++ b/Plugins/60 VM/201 VMs Hot Add Configuration.ps1
@@ -16,7 +16,7 @@ $MEMHotAdd = $true
$CPUHotAdd = Get-vCheckSetting $Title "CPUHotAdd" $CPUHotAdd
$MEMHotAdd = Get-vCheckSetting $Title "MEMHotAdd" $MEMHotAdd
-$VMs | Select-Object Name, @{N="CPU Hot Plug Enabled"; E={$_.ExtensionData.config.CpuHotAddEnabled}}, @{N="Memory Hot Add Enabled"; E={$_.ExtensionData.config.MemoryHotAddEnabled}} | Where {$_."CPU Hot Plug Enabled" -ne $CPUHotAdd -or $_."Memory Hot Add Enabled" -ne $MEMHotAdd}
+$VMs | Select-Object Name, @{N="CPU Hot Plug Enabled"; E={$_.ExtensionData.config.CpuHotAddEnabled}}, @{N="Memory Hot Add Enabled"; E={$_.ExtensionData.config.MemoryHotAddEnabled}} | Where-Object {$_."CPU Hot Plug Enabled" -ne $CPUHotAdd -or $_."Memory Hot Add Enabled" -ne $MEMHotAdd}
# Create variables with unexpected values, for use in the plugin comment
$CPUNotExpected = if ($CPUHotAdd) { "disabled" } else { "enabled" }
diff --git a/Plugins/60 VM/26 No VM Tools.ps1 b/Plugins/60 VM/26 No VM Tools.ps1
index 5390dfb4..b804a94f 100644
--- a/Plugins/60 VM/26 No VM Tools.ps1
+++ b/Plugins/60 VM/26 No VM Tools.ps1
@@ -14,7 +14,7 @@ $VMTDoNotInclude = ""
# Update settings where there is an override
$VMTDoNotInclude = Get-vCheckSetting $Title "VMTDoNotInclude" $VMTDoNotInclude
-$FullVM | Where {$_.Name -notmatch $VMTDoNotInclude -and $_.Runtime.Powerstate -eq "poweredOn" -And ($_.Guest.toolsStatus -eq "toolsNotInstalled" -Or $_.Guest.ToolsStatus -eq "toolsNotRunning")} | Select Name, @{N="Status";E={$_.Guest.ToolsStatus}}
+$FullVM | Where-Object {$_.Name -notmatch $VMTDoNotInclude -and $_.Runtime.Powerstate -eq "poweredOn" -And ($_.Guest.toolsStatus -eq "toolsNotInstalled" -Or $_.Guest.ToolsStatus -eq "toolsNotRunning")} | Select-Object Name, @{N="Status";E={$_.Guest.ToolsStatus}}
# Change Log
## 1.2 : Added Get-vCheckSetting
\ No newline at end of file
diff --git a/Plugins/60 VM/27 VM Tools Issues.ps1 b/Plugins/60 VM/27 VM Tools Issues.ps1
index fa60ec1a..7b8d13b1 100644
--- a/Plugins/60 VM/27 VM Tools Issues.ps1
+++ b/Plugins/60 VM/27 VM Tools Issues.ps1
@@ -14,7 +14,7 @@ $VMTDoNotInclude = ""
# Update settings where there is an override
$VMTDoNotInclude = Get-vCheckSetting $Title "VMTDoNotInclude" $VMTDoNotInclude
-$FullVM | Where {$_.Name -notmatch $VMTDoNotInclude} | Where {$_.Guest.GuestState -eq "Running" -And ($_.Guest.GuestFullName -eq $NULL -or $_.Guest.IPAddress -eq $NULL -or $_.Guest.HostName -eq $NULL -or $_.Guest.Disk -eq $NULL -or $_.Guest.Net -eq $NULL)} | select Name, @{N="IPAddress";E={$_.Guest.IPAddress[0]}},@{n="OSFullName";E={$_.Guest.GuestFullName}},@{n="HostName";e={$_.guest.hostname}},@{N="NetworkLabel";E={$_.guest.Net[0].Network}} -ErrorAction SilentlyContinue |sort Name
+$FullVM | Where-Object {$_.Name -notmatch $VMTDoNotInclude -and $_.Guest.GuestState -eq "Running" -And ($_.Guest.GuestFullName -eq $NULL -or $_.Guest.IPAddress -eq $NULL -or $_.Guest.HostName -eq $NULL -or $_.Guest.Disk -eq $NULL -or $_.Guest.Net -eq $NULL)} | Select-Object Name, @{N="IPAddress";E={$_.Guest.IPAddress[0]}},@{n="OSFullName";E={$_.Guest.GuestFullName}},@{n="HostName";e={$_.guest.hostname}},@{N="NetworkLabel";E={$_.guest.Net[0].Network}} -ErrorAction SilentlyContinue | Sort-Object Name
# Change Log
## 1.2 : Added Get-vCheckSetting
\ No newline at end of file
diff --git a/Plugins/60 VM/28 Removable Media Connected.ps1 b/Plugins/60 VM/28 Removable Media Connected.ps1
index 7c023ab4..d0053cee 100644
--- a/Plugins/60 VM/28 Removable Media Connected.ps1
+++ b/Plugins/60 VM/28 Removable Media Connected.ps1
@@ -16,7 +16,7 @@ $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} |
- Select @{Name="VMName"; Expression={ $VMName}},
+ Select-Object @{Name="VMName"; Expression={ $VMName}},
@{Name="Device Type"; Expression={ $_.GetType().Name}},
@{Name="Device Name"; Expression={ $_.DeviceInfo.Label}},
@{Name="Device Backing"; Expression={ $_.DeviceInfo.Summary}}
diff --git a/Plugins/60 VM/30 Single Storage VMs.ps1 b/Plugins/60 VM/30 Single Storage VMs.ps1
index 4e586206..3c673f5c 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 -Expand Name
+$unSharedDatastore = $storageviews | ?{-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 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
# Change Log
## 1.4 : Added Get-vCheckSetting
\ No newline at end of file
diff --git a/Plugins/60 VM/32 VM CPU Percent RDY.ps1 b/Plugins/60 VM/32 VM CPU Percent RDY.ps1
index 6e866592..4a0b1f0f 100644
--- a/Plugins/60 VM/32 VM CPU Percent RDY.ps1
+++ b/Plugins/60 VM/32 VM CPU Percent RDY.ps1
@@ -24,10 +24,10 @@ Import-LocalizedData -BaseDirectory ($ScriptPath + "\lang") -BindingVariable pLa
$PercCPUReady = Get-vCheckSetting $Title "PercCPUReady" $PercCPUReady
$i=0
-ForEach ($v in ($VM | Where {$_.PowerState -eq "PoweredOn"})){
+ForEach ($v in ($VM | Where-Object {$_.PowerState -eq "PoweredOn"})){
Write-Progress -ID 2 -Parent 1 -Activity $plang.pluginActivity -Status $v.Name -PercentComplete ((100*$i)/$VM.Count)
For ($cpunum = 0; $cpunum -lt $v.NumCpu; $cpunum++){
- $PercReady = [Math]::Round((($v | Get-Stat -ErrorAction SilentlyContinue -Stat Cpu.Ready.Summation -Realtime | Where {$_.Instance -eq $cpunum} | Measure-Object -Property Value -Average).Average)/200,1)
+ $PercReady = [Math]::Round((($v | Get-Stat -ErrorAction SilentlyContinue -Stat Cpu.Ready.Summation -Realtime | Where-Object {$_.Instance -eq $cpunum} | Measure-Object -Property Value -Average).Average)/200,1)
if ($_.PercReady -gt $PercCPUReady)
{
diff --git a/Plugins/60 VM/33 VM CPU Usage.ps1 b/Plugins/60 VM/33 VM CPU Usage.ps1
index f7921b93..ea3a5084 100644
--- a/Plugins/60 VM/33 VM CPU Usage.ps1
+++ b/Plugins/60 VM/33 VM CPU Usage.ps1
@@ -16,7 +16,7 @@ $CPUDays = 1
$CPUValue = Get-vCheckSetting $Title "CPUValue" $CPUValue
$CPUDays = Get-vCheckSetting $Title "CPUDays" $CPUDays
-$VM | Select Name, @{N="AverageCPU";E={[Math]::Round(($_ | Get-Stat -Stat cpu.usage.average -IntervalMins 60 -MaxSamples ($CPUDays*24) -ErrorAction SilentlyContinue | Measure-Object -Property Value -Average).Average)}}, NumCPU, VMHost | Where {$_.AverageCPU -gt $CPUValue} | Sort AverageCPU -Descending
+$VM | Select-Object Name, @{N="AverageCPU";E={[Math]::Round(($_ | Get-Stat -Stat cpu.usage.average -IntervalMins 60 -MaxSamples ($CPUDays*24) -ErrorAction SilentlyContinue | Measure-Object -Property Value -Average).Average)}}, NumCPU, VMHost | Where-Object {$_.AverageCPU -gt $CPUValue} | Sort-Object AverageCPU -Descending
$Header = ("VM(s) CPU above {0}%: [count]" -f $CPUValue)
diff --git a/Plugins/60 VM/37 VM Alarms.ps1 b/Plugins/60 VM/37 VM Alarms.ps1
index 34b54a29..367cd069 100644
--- a/Plugins/60 VM/37 VM Alarms.ps1
+++ b/Plugins/60 VM/37 VM Alarms.ps1
@@ -10,7 +10,7 @@ $PluginCategory = "vSphere"
# End of Settings
$vmsalarms = @()
-foreach ($VMView in ($FullVM | Where {$_.TriggeredAlarmState})){
+foreach ($VMView in ($FullVM | Where-Object {$_.TriggeredAlarmState})){
Foreach ($VMsTriggeredAlarm in $VMView.TriggeredAlarmState){
New-Object -TypeName PSObject -Property @{
Object = $VMView.name
diff --git a/Plugins/60 VM/40 VCB Garbage.ps1 b/Plugins/60 VM/40 VCB Garbage.ps1
index ec2221f9..ed0e911a 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 Name | Select Name
\ No newline at end of file
+$FullVM | ?{$_.snapshot | %{$_.rootsnapshotlist | ?{$_.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 75959dd5..118ddb8f 100644
--- a/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1
+++ b/Plugins/60 VM/45 VMs needing snapshot consolidation.ps1
@@ -11,4 +11,4 @@ $PluginCategory = "vSphere"
$htabHostVersion = @{}
$HostsViews | %{$htabHostVersion.Add($_.MoRef,$_.config.product.version)}
-$FullVM | ?{$htabHostVersion[$_.runtime.host].Split('.')[0] -ge 5 -and $_.runtime.consolidationNeeded} | Sort-Object -Property Name | Select Name,@{N="Consolidation needed";E={$_.Runtime.consolidationNeeded}}
\ No newline at end of file
+$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
diff --git a/Plugins/60 VM/48 Find VM Disk Format.ps1 b/Plugins/60 VM/48 Find VM Disk Format.ps1
index 54f559c2..20d0e2da 100644
--- a/Plugins/60 VM/48 Find VM Disk Format.ps1
+++ b/Plugins/60 VM/48 Find VM Disk Format.ps1
@@ -9,7 +9,7 @@ $DatastoreIgnore = "local"
$diskformat = Get-vCheckSetting $Title "diskformat" $diskformat
$DatastoreIgnore = Get-vCheckSetting $Title "DatastoreIgnore" $DatastoreIgnore
-$VM | Get-HardDisk | where {($_.storageformat -match $diskformat) -and ($_.Filename -notmatch $DatastoreIgnore)} | select @{N="VM";E={$_.parent.name}}, @{N="DiskName";E={$_.name}}, @{N="Format";E={$_.storageformat}}, @{N="FileName";E={$_.filename}}
+$VM | Get-HardDisk | Where-Object {($_.storageformat -match $diskformat) -and ($_.Filename -notmatch $DatastoreIgnore)} | Select-Object @{N="VM";E={$_.parent.name}}, @{N="DiskName";E={$_.name}}, @{N="Format";E={$_.storageformat}}, @{N="FileName";E={$_.filename}}
$Title = "Find VMs with thick or thin provisioned vmdk"
$Header = "VMs with $diskformat provisioned vmdk(s): [count]"
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 fb117232..ad1f9218 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 Name, @{Name="CpuLimitMhz";E={$_.config.cpuallocation.limit}}, @{Name="MemLimitMB";E={$_.config.memoryallocation.limit}}
\ No newline at end of file
+$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
diff --git a/Plugins/60 VM/54 Virtual Machines with incorrect OS Configuration.ps1 b/Plugins/60 VM/54 Virtual Machines with incorrect OS Configuration.ps1
index 9e133d72..a79bd5e7 100644
--- a/Plugins/60 VM/54 Virtual Machines with incorrect OS Configuration.ps1
+++ b/Plugins/60 VM/54 Virtual Machines with incorrect OS Configuration.ps1
@@ -14,7 +14,7 @@ $VMTDoNotInclude = "VM1_*|VM2_*"
# Update settings where there is an override
$VMTDoNotInclude = Get-vCheckSetting $Title "VMTDoNotInclude" $VMTDoNotInclude
-$FullVM | Where {$_.Name -notmatch $VMTDoNotInclude} |`
+$FullVM | Where-Object {$_.Name -notmatch $VMTDoNotInclude} |`
Where-Object {$_.Guest.GuestId -and $_.Guest.GuestId -ne $_.Config.GuestId} | `
Select-Object -Property Name,@{N="GuestId";E={$_.Guest.GuestId}},
@{N="Installed Guest OS";E={$_.Guest.GuestFullName}},
diff --git a/Plugins/60 VM/58 Virtual machines with less hard disks than partitions.ps1 b/Plugins/60 VM/58 Virtual machines with less hard disks than partitions.ps1
index 91b5601d..bb100f29 100644
--- a/Plugins/60 VM/58 Virtual machines with less hard disks than partitions.ps1
+++ b/Plugins/60 VM/58 Virtual machines with less hard disks than partitions.ps1
@@ -14,7 +14,7 @@ $VMTDoNotInclude = "VM1_*|VM2_*"
# Update settings where there is an override
$VMTDoNotInclude = Get-vCheckSetting $Title "VMTDoNotInclude" $VMTDoNotInclude
-$FullVM | Where {$_.Name -notmatch $VMTDoNotInclude} |
+$FullVM | Where-Object {$_.Name -notmatch $VMTDoNotInclude} |
Where-Object {$_.Config.ManagedBy.ExtensionKey -ne 'com.vmware.vcDr'} |
Select-Object -Property Name,@{N="NrOfHardDisks";E={($_.Layout.Disk|measure).count}},@{N="NrOfGuestDisks";E={($_.Guest.Disk|measure).count}},@{N="GuestFamily";E={$_.Guest.GuestFamily}} |
Where-Object {$_.GuestFamily -eq "windowsGuest" -and $_.NrOfHardDisks -lt $_.NrOfGuestDisks}
diff --git a/Plugins/60 VM/61 Guest OS Pivot table.ps1 b/Plugins/60 VM/61 Guest OS Pivot table.ps1
index f1004da5..27bcfbc2 100644
--- a/Plugins/60 VM/61 Guest OS Pivot table.ps1
+++ b/Plugins/60 VM/61 Guest OS Pivot table.ps1
@@ -32,11 +32,11 @@ $FullVM | % {
$myCol = @()
foreach ( $gosname in $VMOSversions.Keys | sort) {
- $MyDetails = "" | select OS, Count
+ $MyDetails = "" | Select-Object OS, Count
$MyDetails.OS = $gosname
$MyDetails.Count = $VMOSversions.$gosname
$myCol += $MyDetails
}
-$myCol | sort Count -desc
+$myCol | Sort-Object Count -desc
Remove-Variable VMOSversions
\ 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 cfc8e970..db340cd2 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 {$_.GetType().Name -match $unwantedHardware} | %{
+ $vmguest.Config.Hardware.Device | Where-Object {$_.GetType().Name -match $unwantedHardware} | %{
New-Object -TypeName PSObject -Property @{
Name = $vmguest.name
Label = $_.DeviceInfo.Label
diff --git a/Plugins/60 VM/620 CBT Status.ps1 b/Plugins/60 VM/620 CBT Status.ps1
index 22d08ac5..d2868355 100644
--- a/Plugins/60 VM/620 CBT Status.ps1
+++ b/Plugins/60 VM/620 CBT Status.ps1
@@ -14,7 +14,7 @@ $CBTEnabled = $false
# Update settings where there is an override
$CBTEnabled = Get-vCheckSetting $Title "CBTEnabled" $CBTEnabled
-$FullVm | Where-object {$_.Config.ChangeTrackingEnabled -eq $CBTEnabled} | Select-Object Name, @{Name="Change Block Tracking";Expression={if ($_.Config.ChangeTrackingEnabled) { "enabled" } else { "disabled" }}} | Sort Name
+$FullVm | Where-object {$_.Config.ChangeTrackingEnabled -eq $CBTEnabled} | Select-Object Name, @{Name="Change Block Tracking";Expression={if ($_.Config.ChangeTrackingEnabled) { "enabled" } else { "disabled" }}} | Sort-Object Name
# Change Log
## 1.1 : Added Get-vCheckSetting
\ No newline at end of file
diff --git a/Plugins/60 VM/64 Snapshots Oversize.ps1 b/Plugins/60 VM/64 Snapshots Oversize.ps1
index dbb213fd..7973ae27 100644
--- a/Plugins/60 VM/64 Snapshots Oversize.ps1
+++ b/Plugins/60 VM/64 Snapshots Oversize.ps1
@@ -10,7 +10,7 @@ $PluginCategory = "vSphere"
# End of Settings
$snapp = @()
-Foreach ($vmg in ($VM | Where {$_.ExtensionData.Snapshot})) {
+Foreach ($vmg in ($VM | Where-Object {$_.ExtensionData.Snapshot})) {
$hddsize = ($vmg | Get-HardDisk | Measure-Object -sum CapacityGB).sum
$snapInfo = $vmg | Get-Snapshot | Measure-Object -Sum SizeGB
@@ -28,7 +28,7 @@ Foreach ($vmg in ($VM | Where {$_.ExtensionData.Snapshot})) {
})
}
-$snapp | select VM, vmdkSizeGB, SnapSizeGB, SnapCount, @{N="OverSize %";E={$_.OverSize}} | sort "OverSize %" -Descending
+$snapp | Select-Object VM, vmdkSizeGB, SnapSizeGB, SnapCount, @{N="OverSize %";E={$_.OverSize}} | Sort-Object "OverSize %" -Descending
# Changelog
## 1.3 : Rewritten to cleanup and compare vmdk size to only snapshot size
diff --git a/Plugins/60 VM/66 Misnamed VM.ps1 b/Plugins/60 VM/66 Misnamed VM.ps1
index 6b130b43..483fc5f4 100644
--- a/Plugins/60 VM/66 Misnamed VM.ps1
+++ b/Plugins/60 VM/66 Misnamed VM.ps1
@@ -14,7 +14,7 @@ $MNDoNotInclude = "VM1_*|VM2_*"
# Update settings where there is an override
$MNDoNotInclude = Get-vCheckSetting $Title "MNDoNotInclude" $MNDoNotInclude
-($FullVM | Where {$_.Runtime.PowerState -eq 'poweredOn' -AND $_.Name -notmatch $MNDoNotInclude -AND $_.Guest.HostName -ne "" -AND $_.Guest.HostName -notmatch $_.Name }) |
+($FullVM | Where-Object {$_.Runtime.PowerState -eq 'poweredOn' -AND $_.Name -notmatch $MNDoNotInclude -AND $_.Guest.HostName -ne "" -AND $_.Guest.HostName -notmatch $_.Name }) |
foreach {
$vmguest = $_
if ($vmguest.Parent -ne $null)
diff --git a/Plugins/60 VM/78 Reset VMs.ps1 b/Plugins/60 VM/78 Reset VMs.ps1
index e842b803..8250310b 100644
--- a/Plugins/60 VM/78 Reset VMs.ps1
+++ b/Plugins/60 VM/78 Reset VMs.ps1
@@ -12,7 +12,7 @@ $VMsResetAge = 1
# Update settings where there is an override
$VMsResetAge = Get-vCheckSetting $Title "VMsResetAge" $VMsResetAge
-Get-VIEventPlus -Start ((get-date).adddays(-$VMsResetAge)) -EventType "VmResettingEvent" | Select createdTime, UserName, fullFormattedMessage
+Get-VIEventPlus -Start ((get-date).adddays(-$VMsResetAge)) -EventType "VmResettingEvent" | Select-Object createdTime, UserName, fullFormattedMessage
$Header = ("VMs Reset (Last {0} Day(s)) : [count]" -f $VMsResetAge)
$Comments = ("The following VMs have been reset over the last {0} days" -f $VMsResetAge)
diff --git a/Plugins/60 VM/79 Find VMs in Uncontrolled Snapshot Mode.ps1 b/Plugins/60 VM/79 Find VMs in Uncontrolled Snapshot Mode.ps1
index 7d9b307c..30cd5e73 100644
--- a/Plugins/60 VM/79 Find VMs in Uncontrolled Snapshot Mode.ps1
+++ b/Plugins/60 VM/79 Find VMs in Uncontrolled Snapshot Mode.ps1
@@ -21,21 +21,21 @@ $pLang = DATA {
Import-LocalizedData -BaseDirectory ($ScriptPath + "\lang") -BindingVariable pLang -ErrorAction SilentlyContinue
$i=0;
-foreach ($eachDS in ($Datastores | Where {$_.State -eq "Available"})) {
+foreach ($eachDS in ($Datastores | Where-Object {$_.State -eq "Available"})) {
Write-Progress -ID 2 -Parent 1 -Activity $pLang.pluginActivity -Status ($pLang.pluginStatus -f $i, $Datastores.count, $eachDS.Name) -PercentComplete ($i*100/$Datastores.count)
$eachDS.Name
$FilePath = $eachDS.DatastoreBrowserPath + '\*\*delta.vmdk*'
- $fileList = @(Get-ChildItem -Path "$FilePath" | Select Name, FolderPath, FullName)
+ $fileList = @(Get-ChildItem -Path "$FilePath" | Select-Object Name, FolderPath, FullName)
$FilePath = $eachDS.DatastoreBrowserPath + '\*\-*-flat.vmdk'
- $fileList += Get-ChildItem -Path "$FilePath" | Select Name, FolderPath, FullName
+ $fileList += Get-ChildItem -Path "$FilePath" | Select-Object Name, FolderPath, FullName
$i++
- foreach ($vmFile in $filelist | sort FolderPath)
+ foreach ($vmFile in $filelist | Sort-Object FolderPath)
{
$vmFile.FolderPath -match '^\[([^\]]+)\] ([^/]+)' > $null
$VMName = $matches[2]
- $eachVM = $FullVM | where {$_.Name -eq $VMName}
+ $eachVM = $FullVM | Where-Object {$_.Name -eq $VMName}
if (!$eachVM.snapshot)
{
# Only process VMs without snapshots
diff --git a/Plugins/60 VM/85 Snapshot Activity.ps1 b/Plugins/60 VM/85 Snapshot Activity.ps1
index 019209d1..86dd5fab 100644
--- a/Plugins/60 VM/85 Snapshot Activity.ps1
+++ b/Plugins/60 VM/85 Snapshot Activity.ps1
@@ -16,7 +16,7 @@ $snapshotUserException = "s-veeam"
$VMsNewRemovedAge = Get-vCheckSetting $Title "VMsNewRemovedAge" $VMsNewRemovedAge
$snapshotUserException = Get-vCheckSetting $Title "snapshotUserException" $snapshotUserException
-Get-VIEventPlus -Start ((get-date).adddays(- $VMsNewRemovedAge)) -EventType "TaskEvent" | ? { $_.FullFormattedMessage -match "snapshot" -and $_.userName -notmatch $snapshotUserException } | Select @{ N = "Created Time"; E = { ($_.createdTime).ToLocalTime() } }, @{ N = "User"; E = { $_.userName } }, @{ N = "VM Name"; E = { $_.vm.name } }, @{ N = "Description"; E = { $_.FullFormattedMessage } } | sort "VM Name", "Created Time"
+Get-VIEventPlus -Start ((get-date).adddays(- $VMsNewRemovedAge)) -EventType "TaskEvent" | ? { $_.FullFormattedMessage -match "snapshot" -and $_.userName -notmatch $snapshotUserException } | Select-Object @{ N = "Created Time"; E = { ($_.createdTime).ToLocalTime() } }, @{ N = "User"; E = { $_.userName } }, @{ N = "VM Name"; E = { $_.vm.name } }, @{ N = "Description"; E = { $_.FullFormattedMessage } } | Sort-Object "VM Name", "Created Time"
$Comments = ("Last {0} Day(s) with user exception {1}" -f $VMsNewRemovedAge, $snapshotUserException)
diff --git a/Plugins/70 Misc/108 SRM RPO Violations.ps1 b/Plugins/70 Misc/108 SRM RPO Violations.ps1
index 5cbc8f88..3f6f8f64 100644
--- a/Plugins/70 Misc/108 SRM RPO Violations.ps1
+++ b/Plugins/70 Misc/108 SRM RPO Violations.ps1
@@ -53,13 +53,13 @@ $ActiveViolationsOnly = Get-vCheckSetting $Title "ActiveViolationsOnly" $ActiveV
## Begin code block obtained from: http://www.virtu-al.net/2013/06/14/reporting-on-rpo-violations-from-vsphere-replication/
# modified by Joel Gibson
-Foreach ($RPOvm in ($VMs | Where { $_.name -match $VMNameRegex })) {
- $RPOEvents = Get-VIEventPlus -Entity $RPOvm | where { $_.EventTypeID -match "rpo" } | Where { $_.Vm.Name -eq $RPOvm.Name } | Select EventTypeId, CreatedTime, FullFormattedMessage, @{Name="VMName";Expression={$_.Vm.Name}} | Sort CreatedTime
+Foreach ($RPOvm in ($VMs | Where-Object { $_.name -match $VMNameRegex })) {
+ $RPOEvents = Get-VIEventPlus -Entity $RPOvm | Where-Object { $_.EventTypeID -match "rpo" -and $_.Vm.Name -eq $RPOvm.Name } | Select-Object EventTypeId, CreatedTime, FullFormattedMessage, @{Name="VMName";Expression={$_.Vm.Name}} | Sort-Object CreatedTime
if ($RPOEvents) {
$Count = 0
do {
- $details = "" | Select VMName, ViolationStart, ViolationEnd, Mins
+ $details = "" | Select-Object VMName, ViolationStart, ViolationEnd, Mins
if ($RPOEvents[$count].EventTypeID -match "Violated") {
If (-not $details.Start) {
$Details.VMName = $RPOEvents[$Count].VMName
diff --git a/Plugins/80 Finish/118 Plugins Not up to date or installed.ps1.disabled b/Plugins/80 Finish/118 Plugins Not up to date or installed.ps1.disabled
index 4ab4905f..d4bd4a68 100644
--- a/Plugins/80 Finish/118 Plugins Not up to date or installed.ps1.disabled
+++ b/Plugins/80 Finish/118 Plugins Not up to date or installed.ps1.disabled
@@ -10,9 +10,9 @@ $proxy = "$false"
. $ScriptPath\vcheckutils.ps1 | Out-Null
if ($proxy -eq "$false"){
- $NotInstalled = Get-vCheckPlugin | Where {$_.Category -eq "vSphere" -and ($_.status -eq "Not Installed" -or $_.status -match "New Version Available")} | Select Name, version, Status, Description
+ $NotInstalled = Get-vCheckPlugin | Where-Object {$_.Category -eq "vSphere" -and ($_.status -eq "Not Installed" -or $_.status -match "New Version Available")} | Select-Object Name, version, Status, Description
} else {
- $NotInstalled = Get-vCheckPlugin -Proxy $proxy | Where {$_.Category -eq "vSphere" -and ($_.status -eq "Not Installed" -or $_.status -match "New Version Available")} | Select Name, version, Status, Description
+ $NotInstalled = Get-vCheckPlugin -Proxy $proxy | Where-Object {$_.Category -eq "vSphere" -and ($_.status -eq "Not Installed" -or $_.status -match "New Version Available")} | Select-Object Name, version, Status, Description
}
$NotInstalled
diff --git a/Select-Plugins.ps1 b/Select-Plugins.ps1
index 711ad5dd..b053eecb 100644
--- a/Select-Plugins.ps1
+++ b/Select-Plugins.ps1
@@ -54,7 +54,7 @@ If ($PluginPath -notmatch 'plugins$') {
$PluginPath += "\Plugins"
}
$plugins = Get-ChildItem -Path $PluginPath -Include *.ps1, *.ps1.disabled -Recurse |
- Sort {[int]($_.Name -replace '\D')} |
+ Sort-Object {[int]($_.Name -replace '\D')} |
Select FullName, Name,
@{Label="Plugin";expression={$_.Name -replace '(.*)\.ps1(?:\.disabled|)$', '$1'}},
@{Label="Enabled";expression={$_.Name -notmatch '.*\.disabled$'}}
diff --git a/Styles/CleanGreen/Style.ps1 b/Styles/CleanGreen/Style.ps1
index 9185ac8b..1a3c86ad 100644
--- a/Styles/CleanGreen/Style.ps1
+++ b/Styles/CleanGreen/Style.ps1
@@ -72,7 +72,7 @@ function Get-PluginHTML {
#>
function Get-ReportTOC {
$TOCHTML = ""
- foreach ($pr in ($PluginResult | Where {$_.Details})) {
+ foreach ($pr in ($PluginResult | Where-Object {$_.Details})) {
$TOCHTML += ("- {1}
" -f $pr.PluginID, $pr.Title)
}
$TOCHTML += "
"
diff --git a/Styles/VMware/Style.ps1 b/Styles/VMware/Style.ps1
index f16d8a7f..32bac19e 100644
--- a/Styles/VMware/Style.ps1
+++ b/Styles/VMware/Style.ps1
@@ -82,7 +82,7 @@ function Get-ReportTOC {
$TOCHTML = ""
$i = 0
- foreach ($pr in ($PluginResult | Where {$_.Details})) {
+ foreach ($pr in ($PluginResult | Where-Object {$_.Details})) {
$TOCHTML += ("{1} | " -f $pr.PluginID, $pr.Title)
$i++
diff --git a/vCheck.ps1 b/vCheck.ps1
index 440ad4e6..4590f254 100644
--- a/vCheck.ps1
+++ b/vCheck.ps1
@@ -358,7 +358,7 @@ Function Get-HTMLTable {
# If only one column, fix up the table header
if (($content | Get-Member -MemberType Properties).count -eq 1)
{
- $XMLTable.table.tr[0].th = (($content | Get-Member -MemberType Properties) | Select -ExpandProperty Name -First 1).ToString()
+ $XMLTable.table.tr[0].th = (($content | Get-Member -MemberType Properties) | Select-Object -ExpandProperty Name -First 1).ToString()
}
# If format rules are specified
@@ -447,7 +447,7 @@ Function Get-HTMLList {
# If only one column, fix up the table header
if (($content | Get-Member -MemberType Properties).count -eq 1)
{
- $XMLTable.table.tr[0].th = (($content | Get-Member -MemberType Properties) | Select -ExpandProperty Name -First 1).ToString()
+ $XMLTable.table.tr[0].th = (($content | Get-Member -MemberType Properties) | Select-Object -ExpandProperty Name -First 1).ToString()
}
return (Format-HTMLEntities ([string]($XMLTable.OuterXml)))
@@ -788,7 +788,7 @@ if ($job) {
foreach ($PluginPath in ($jobConfig.vCheck.plugins.path -split ";")) {
if (Test-Path $PluginPath) {
$PluginPaths += (Get-Item $PluginPath).Fullname
- $PluginPaths += Get-Childitem $PluginPath -Recurse | ?{ $_.PSIsContainer } | Select -ExpandProperty FullName
+ $PluginPaths += Get-Childitem $PluginPath -Recurse | ?{ $_.PSIsContainer } | Select-Object -ExpandProperty FullName
} else {
$PluginPaths += $ScriptPath + "\Plugins"
Write-Warning ($lang.pluginpathInvalid -f $PluginPath, ($ScriptPath + "\Plugins"))
@@ -819,10 +819,10 @@ if ($job) {
}
} else {
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) }
- $vCheckPlugins = @(Get-ChildItem -Path $PluginsFolder -filter "*.ps1" -Recurse | where { $_.Directory -match "initialize" } | Sort-Object $ToNatural)
- $PluginsSubFolder = Get-ChildItem -Path $PluginsFolder | where { ($_.PSIsContainer) -and ($_.Name -notmatch "initialize") -and ($_.Name -notmatch "finish") }
+ $vCheckPlugins = @(Get-ChildItem -Path $PluginsFolder -filter "*.ps1" -Recurse | Where-Object { $_.Directory -match "initialize" } | Sort-Object $ToNatural)
+ $PluginsSubFolder = Get-ChildItem -Path $PluginsFolder | Where-Object { ($_.PSIsContainer) -and ($_.Name -notmatch "initialize") -and ($_.Name -notmatch "finish") }
$vCheckPlugins += $PluginsSubFolder | % { Get-ChildItem -Path $_.FullName -filter "*.ps1" | Sort-Object $ToNatural }
- $vCheckPlugins += Get-ChildItem -Path $PluginsFolder -filter "*.ps1" -Recurse | where { $_.Directory -match "finish" } | Sort-Object $ToNatural
+ $vCheckPlugins += Get-ChildItem -Path $PluginsFolder -filter "*.ps1" -Recurse | Where-Object { $_.Directory -match "finish" } | Sort-Object $ToNatural
$GlobalVariables = $ScriptPath + "\GlobalVariables.ps1"
}
@@ -953,7 +953,7 @@ if (-not $GUIConfig) {
foreach ($Plugin in (Get-ChildItem $PluginsFolder -Include *.ps1, *.ps1.disabled -Recurse)) {
$Plugins += New-Object PSObject -Property @{
"Name" = (Get-PluginID $Plugin.FullName).Title;
- "Enabled" = (($vCheckPlugins | Select -ExpandProperty FullName) -Contains $plugin.FullName)
+ "Enabled" = (($vCheckPlugins | Select-Object -ExpandProperty FullName) -Contains $plugin.FullName)
}
}
@@ -982,7 +982,7 @@ if (-not $GUIConfig) {
"Title" = $lang.repTTRTitle;
"Author" = "vCheck";
"Version" = $vCheckVersion;
- "Details" = ($PluginResult | Where { $_.TimeToRun -gt $PluginSeconds } | Select Title, TimeToRun | Sort-Object TimeToRun -Descending);
+ "Details" = ($PluginResult | Where-Object { $_.TimeToRun -gt $PluginSeconds } | Select-Object Title, TimeToRun | Sort-Object TimeToRun -Descending);
"Display" = "List";
"TableFormat" = $null;
"Header" = ($lang.repTime -f [math]::round(($Finished - $Date).TotalMinutes, 2), ($Finished.ToLongDateString()), ($Finished.ToLongTimeString()));
diff --git a/vCheckUtils.ps1 b/vCheckUtils.ps1
index 0d88d514..067c8eaf 100644
--- a/vCheckUtils.ps1
+++ b/vCheckUtils.ps1
@@ -135,11 +135,11 @@ function Get-vCheckPlugin
foreach ($plugin in $plugins.pluginlist.plugin)
{
- $pluginObjectList | where {$_.name -eq $plugin.name -and [double]$_.version -lt [double]$plugin.version}|
+ $pluginObjectList | Where-Object {$_.name -eq $plugin.name -and [double]$_.version -lt [double]$plugin.version}|
foreach{
$_.status = "New Version Available - " + $plugin.version
}
- if (!($pluginObjectList | where {$_.name -eq $plugin.name}))
+ if (!($pluginObjectList | Where-Object {$_.name -eq $plugin.name}))
{
$pluginObject = New-Object PSObject
$pluginObject | Add-Member -MemberType NoteProperty -Name name -value $plugin.name
@@ -162,15 +162,15 @@ function Get-vCheckPlugin
}
if ($name){
- $pluginObjectList | where {$_.name -eq $name}
+ $pluginObjectList | Where-Object {$_.name -eq $name}
} Else {
if ($category){
- $pluginObjectList | Where {$_.Category -eq $category}
+ $pluginObjectList | Where-Object {$_.Category -eq $category}
} Else {
if($notinstalled){
- $pluginObjectList | where {$_.status -eq "Not Installed"}
+ $pluginObjectList | Where-Object {$_.status -eq "Not Installed"}
} elseif($pendingupdate) {
- $pluginObjectList | where {$_.status -like "New Version Available*"}
+ $pluginObjectList | Where-Object {$_.status -like "New Version Available*"}
}
Else {
$pluginObjectList
@@ -523,7 +523,7 @@ Function Export-vCheckSettings {
Foreach ($plugin in (Get-ChildItem -Path $vCheckPath\Plugins\* -Include *.ps1, *.ps1.disabled -Recurse)) {
$Export += Get-PluginSettings -Filename $plugin.Fullname
}
- $Export | Select filename, question, var | Export-Csv -NoTypeInformation $outfile
+ $Export | Select-Object filename, question, var | Export-Csv -NoTypeInformation $outfile
}
@@ -611,10 +611,10 @@ Function Import-vCheckSettings {
}
$Import = Import-Csv $csvfile
$GlobalVariables = "$vCheckPath\GlobalVariables.ps1"
- $settings = $Import | Where {($_.filename).Split("\")[-1] -eq ($GlobalVariables).Split("\")[-1]}
+ $settings = $Import | Where-Object {($_.filename).Split("\")[-1] -eq ($GlobalVariables).Split("\")[-1]}
Set-PluginSettings -Filename $GlobalVariables -Settings $settings -GB
Foreach ($plugin in (Get-ChildItem -Path $vCheckPath\Plugins\* -Include *.ps1, *.ps1.disabled -Recurse)) {
- $settings = $Import | Where {($_.filename).Split("\")[-1] -eq ($plugin.Fullname).Split("\")[-1]}
+ $settings = $Import | Where-Object {($_.filename).Split("\")[-1] -eq ($plugin.Fullname).Split("\")[-1]}
Set-PluginSettings -Filename $plugin.Fullname -Settings $settings
}
Write-Warning "`nImport Complete!`n"
@@ -656,10 +656,10 @@ Function Import-vCheckSettingsXML {
}
$Import = [xml](Get-Content $xmlFile)
$GlobalVariables = "$vCheckPath\GlobalVariables.ps1"
- $settings = $Import.vCheck.Setting | Where {($_.filename).Split("\")[-1] -eq ($GlobalVariables).Split("\")[-1]}
+ $settings = $Import.vCheck.Setting | Where-Object {($_.filename).Split("\")[-1] -eq ($GlobalVariables).Split("\")[-1]}
Set-PluginSettings -Filename $GlobalVariables -Settings $settings -GB
Foreach ($plugin in (Get-ChildItem -Path "$vCheckPath\Plugins\" -Filter "*.ps1" -Recurse)) {
- $settings = $Import.vCheck.Setting | Where {($_.filename).Split("\")[-1] -eq ($plugin.Fullname).Split("\")[-1]}
+ $settings = $Import.vCheck.Setting | Where-Object {($_.filename).Split("\")[-1] -eq ($plugin.Fullname).Split("\")[-1]}
Set-PluginSettings -Filename $plugin.Fullname -Settings $settings
}
Write-Warning "`nImport Complete!`n"
@@ -750,7 +750,7 @@ param (
while ( ($i -lt $end) -and ($contents[$i] -notmatch "Start of Settings") ) { $i++ }
while ( ($i -lt $end) -and ($contents[$i] -notmatch "End of Settings") ) {
- if ($contents[$i] -match "`=") { "" | select @{n='File';e={$PluginFile.fullname}},@{n='Variable';e={$contents[$i]}}; $i++ }
+ if ($contents[$i] -match "`=") { "" | Select-Object @{n='File';e={$PluginFile.fullname}},@{n='Variable';e={$contents[$i]}}; $i++ }
else { $i++ }
}
@@ -954,7 +954,7 @@ Function Get-vCheckLogData {
$ContextInfo = Select-String "Plugin Start - $Section" $vCheckFile -context 0,6
# lines 3-6 are the data we want.
- $table = $ContextInfo.Context.PostContext | select -last 4
+ $table = $ContextInfo.Context.PostContext | Select-Object -last 4
# The table actually ends on line 7. But line 6 looks like this:
#
Back To Top
|