This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$esxCred = Get-Credential | |
Connect-VIServer $esx -Credential $esxCred | |
$esxcli = Get-ESXcli | |
# Add the claim rule and test for its existence. This also fails if the claim rule | |
# is already present. | |
try { | |
$esxcli.storage.nmp.satp.rule.add($null,"tpgs_on", | |
"HP 3PAR Custom ALUA Rule", $null, $null, $null, "VV", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# esxcli storage nmp satp rule add -s "VMW_SATP_ALUA" -P "VMW_PSP_RR" –O "iops=1" -c "tpgs_on" -V "3PARdata" -M "VV" -e "HP 3PAR Custom Rule" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get-MailboxSizes.ps1 | |
# | |
# Requires Microsoft Active Directory module | |
If ((Get-Module | Where { $_.Name -eq "ActiveDirectory"}) -eq $null) { | |
Import-Module ActiveDirectory; | |
If ((Get-Module | Where { $_.Name -eq "ActiveDirectory"}) -eq $null) { throw "ActiveDirectory Module is required." } | |
} | |
$colServers = @("Server1", "Server2") # array of Exchange Servers to poll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Our XAML for the WPF-based GUI. | |
$inputXAML = @" | |
<Window x:Name="Pick_Console" x:Class="LetUsWPF.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:LetUsWPF" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="275" Width="410"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load WPF support and our XML into a form | |
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework') | |
try { | |
$Form = [Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml)) | |
} | |
catch { | |
Write-Host "Failed to load Windows.Markup.XamlReader. Invalid XML?" | |
exit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load XAML Objects into variables | |
$xaml.SelectNodes("//*[@Name]") | | |
Where-Object { $_.Name -notlike "label_*" } | | |
ForEach-Object { Set-Variable -Name "WPF_$($_.Name)" -Value $Form.FindName($_.Name) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Event Handlers for our WPF controls | |
# | |
# WPF form is loaded | |
$Form.Add_Loaded({ | |
# Connect to vCenter and populate the list of clusters | |
Connect-VIServer $vCenter | |
Get-Cluster | ForEach-Object { $WPF_cluster.Items.Add($_.Name) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Variables that you can/should change | |
# | |
$vCenter = "my-vcsa" | |
# Present! | |
$form.ShowDialog() | Out-Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Our XAML for the WPF-based GUI. | |
$inputXAML = @" | |
<Window x:Name="Pick_Console" x:Class="LetUsWPF.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:LetUsWPF" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="275" Width="410"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Templates = @() | |
$Hosts = Get-VMHost | |
foreach ($h in $hosts) { | |
$HostTemplates = Get-Template -Location $h | |
foreach ($t in $HostTemplates) { | |
$TemplateInfo = New-Object PSObject | |
$TemplateInfo | Add-Member -MemberType NoteProperty Name -Value $t.Name | |
$TemplateInfo | Add-Member -MemberType NoteProperty Host -Value $h.Name | |
$Templates += $TemplateInfo | |
} |
OlderNewer