Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $inputXML= @"
- <Window x:Class="Powershell_Control_Panel.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:Powershell_Control_Panel"
- mc:Ignorable="d"
- Title="Wiggle Accounts Control Panel" Height="768" Width="1366">
- <Grid Margin="0,0,2,-4" Background="#FF608977">
- <Grid.RowDefinitions>
- <RowDefinition Height="121*"/>
- <RowDefinition Height="467*"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Button x:Name="button" Content="Disable Account" HorizontalAlignment="Left" Height="45" Margin="148,30,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="#FF0A0101">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy" Content="Enable Account" HorizontalAlignment="Left" Height="45" Margin="148,98,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy1" Content="Set Account Expiry " HorizontalAlignment="Left" Height="45" Margin="148,239,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy2" Content="" HorizontalAlignment="Left" Height="45" VerticalAlignment="Top" Width="176" Grid.Row="1" Margin="1067,30,0,0" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy3" Content="" HorizontalAlignment="Left" Height="45" Margin="1067,98,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy4" Content="" HorizontalAlignment="Left" Height="45" Margin="1067,168,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy5" Content="Account Name Change" HorizontalAlignment="Left" Height="45" Margin="148,309,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy6" Content="Account Information" HorizontalAlignment="Left" Height="45" Margin="148,377,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy7" Content="Unblock Account" HorizontalAlignment="Left" Height="45" Margin="148,168,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" BorderBrush="Black" Background="#FFA7AC77">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy8" Content="Get Computer Information" HorizontalAlignment="Left" Height="45" Margin="620,30,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy9" Content="Get Members of a Group" HorizontalAlignment="Left" Height="45" Margin="620,98,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy10" Content="Get Mailbox GUID" HorizontalAlignment="Left" Height="45" Margin="620,168,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy11" Content="Check Microsoft Licenses" HorizontalAlignment="Left" Height="45" Margin="620,239,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy12" Content="" HorizontalAlignment="Left" Height="45" Margin="620,309,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Button x:Name="button_Copy13" Content="" HorizontalAlignment="Left" Height="45" Margin="620,377,0,0" VerticalAlignment="Top" Width="176" Grid.Row="1" FontFamily="Nirmala UI" FontSize="14" Background="#FFA7AC77" BorderBrush="Black">
- <Button.Effect>
- <DropShadowEffect/>
- </Button.Effect>
- </Button>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="152" VerticalAlignment="Top" Width="450">
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="132" Margin="9,9,0,0" VerticalAlignment="Top" Width="430"/>
- </Border>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="152" VerticalAlignment="Top" Width="450">
- <Border.Background>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="Black" Offset="0"/>
- <GradientStop Color="#FF88B673" Offset="0.56"/>
- <GradientStop Color="#FF8F8F8F" Offset="0.757"/>
- </LinearGradientBrush>
- </Border.Background>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="132" Margin="9,9,0,0" VerticalAlignment="Top" Width="430" Background="#FF608977">
- <TextBox x:Name="textBox1" TextWrapping="Wrap" Text="Account Scripts" FontWeight="Bold" Margin="130,45,130,50" FontSize="22" BorderThickness="0">
- <TextBox.Background>
- <ImageBrush/>
- </TextBox.Background>
- </TextBox>
- </Border>
- </Border>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="152" VerticalAlignment="Top" Width="450" Margin="453,0,0,0">
- <Border.Background>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="Black" Offset="0"/>
- <GradientStop Color="#FF88B673" Offset="0.56"/>
- <GradientStop Color="#FF8F8F8F" Offset="0.757"/>
- </LinearGradientBrush>
- </Border.Background>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="132" Margin="9,9,0,0" VerticalAlignment="Top" Width="430" Background="#FF608977">
- <TextBox x:Name="textBox2" TextWrapping="Wrap" Text="Get-Info Scripts" FontWeight="Bold" Margin="130,45,130,50" FontSize="21" BorderThickness="0">
- <TextBox.Background>
- <ImageBrush/>
- </TextBox.Background>
- </TextBox>
- </Border>
- </Border>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="152" VerticalAlignment="Top" Width="450" Margin="906,0,0,0">
- <Border.Background>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="Black" Offset="0"/>
- <GradientStop Color="#FF88B673" Offset="0.56"/>
- <GradientStop Color="#FF8F8F8F" Offset="0.757"/>
- </LinearGradientBrush>
- </Border.Background>
- <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="132" Margin="9,9,0,0" VerticalAlignment="Top" Width="430" Background="#FF608977">
- <TextBox x:Name="textBox3" TextWrapping="Wrap" Text="Misc" FontWeight="Bold" Margin="189,45,174,50" FontSize="22" BorderThickness="0">
- <TextBox.Background>
- <ImageBrush/>
- </TextBox.Background>
- </TextBox>
- </Border>
- </Border>
- <Button x:Name="button" Content="Close" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1022,530,5,10" Grid.Row="1" Width="329" RenderTransformOrigin="0.5,0.5" Background="#FF958A8A" Height="49" BorderBrush="Black"/>
- </Grid>
- </Window>
- "@
- $inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
- [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
- [xml]$XAML = $inputXML
- #Read XAML
- $reader=(New-Object System.Xml.XmlNodeReader $xaml)
- try{$Form=[Windows.Markup.XamlReader]::Load( $reader )}
- catch{Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."}
- #===========================================================================
- # Load XAML Objects In PowerShell
- #===========================================================================
- $xaml.SelectNodes("//*[@Name]") | %{Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name)}
- Function Get-FormVariables{
- if ($global:ReadmeDisplay -ne $true){Write-host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow;$global:ReadmeDisplay=$true}
- write-host "Found the following interactable elements from our form" -ForegroundColor Cyan
- get-variable WPF*
- }
- Get-FormVariables
- #===========================================================================
- # Actually make the objects work
- #===========================================================================
- #Sample entry of how to add data to a field
- #$vmpicklistView.items.Add([pscustomobject]@{'VMName'=($_).Name;Status=$_.Status;Other="Yes"})
- #===========================================================================
- # Shows the form
- #===========================================================================
- write-host "To show the form, run the following" -ForegroundColor Cyan
- $Form.ShowDialog() | out-null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement