# encoding: ascii
# api: xml
# title: Instances
# description: From gregs repository on github. Plugin for wmiexplorer (copy this file into “Plugins” folder in $PSScriptRoot directory)
# version: 1.01
# author: Janny
# license: CC0
# x-poshcode-id: 4877
# x-archived: 2014-02-07T23:47:32
# x-published: 2014-02-04T14:00:00
#
#
<?xml version="1.0"?>
<WmiExplorerPlugin>
<PluginAuthor>greg zakharov</PluginAuthor>
<PluginVersion>1.01</PluginVersion>
<InjectObject>$mnuInst</InjectObject>
<ObjectText>&Show Instances</ObjectText>
<Code>
if (Get-UserStatus) {
$frmInst = New-Object Windows.Forms.Form
$rtbInst = New-Object Windows.Forms.RichTextBox
#
#rtbInst
#
$rtbInst.Dock = [Windows.Forms.DockStyle]::Fill
$rtbInst.ReadOnly = $true
#
#frmInst
#
$frmInst.ClientSize = New-Object Drawing.Size(530, 270)
$frmInst.Controls.Add($rtbInst)
$frmInst.Icon = $ico
$frmInst.StartPosition = [Windows.Forms.FormStartPosition]::CenterParent
$frmInst.Text = "Instances"
$frmInst.Add_Load({
try {
$ins = $wmi.GetInstances()
if ($ins.Count -ne 0) {
foreach ($i in $ins) {
$i.PSBase.Properties | % {
$rtbInst.SelectionFont = $bol2
$rtbInst.AppendText($_.Name + ': ')
$rtbInst.SelectionFont = $norm
if ($_.Value -eq $null) {
$rtbInst.AppendText("`n")
}
elseif ($_.IsArray) {
$ofs = ";"
$rtbInst.AppendText("$($_.Value)")
$ofs = $null
$rtbInst.AppendText("`n")
}
else {
$rtbInst.AppendText("$($_.Value)`n")
}
}
$rtbInst.AppendText("`n$('=' * 57)`n")
}
} #if
else {
$rtbInst.SelectionFont = $bol1
$rtbInst.AppendText("Out of context.")
}
}
catch [Management.Automation.RuntimeException] {}
}) #form load
[void]$frmInst.ShowDialog()
}
</Code>
</WmiExplorerPlugin>