134 lines
7.3 KiB
PowerShell
134 lines
7.3 KiB
PowerShell
function Load_r710 {
|
|
param ($root)
|
|
[XML]$Form = @"
|
|
<?xaml encoding="utf-8"?>
|
|
<Window
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Name="Window" Title="HDS Admin Panel - gaming Script" Height="404" Width="510" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
|
|
<Grid Background="#00344E">
|
|
<Button Name="btnok" Content="Close" HorizontalAlignment="Left" Margin="11,358,0,0" VerticalAlignment="Top" Width="111" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
|
|
<Button.Resources>
|
|
<Style TargetType="Border">
|
|
<Setter Property="CornerRadius" Value="2"/>
|
|
</Style>
|
|
</Button.Resources>
|
|
<Button.Style>
|
|
<Style TargetType="Button">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="Red"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|
|
<Label Content="R710" HorizontalAlignment="Center" VerticalAlignment="Top" Width="377" HorizontalContentAlignment="Center" Foreground="White" FontSize="20" FontWeight="Bold" Margin="0,5,0,0"/>
|
|
<Label x:Name="l2" Content="Power Status:" HorizontalAlignment="Left" Margin="11,148,0,0" VerticalAlignment="Top" Width="95" Height="26" FontSize="12" Foreground="White"/>
|
|
<Button TabIndex="4" x:Name="btnstart" Content="Start" ToolTip="aps the PowerButton of MEG" BorderThickness="0" HorizontalAlignment="Left" Margin="11,55,0,0" VerticalAlignment="Top" Width="111" Height="26" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
|
|
<Button.Resources>
|
|
<Style TargetType="{x:Type Border}">
|
|
<Setter Property="CornerRadius" Value="2"/>
|
|
</Style>
|
|
</Button.Resources>
|
|
</Button>
|
|
<Label x:Name="l2_Kopieren" Content="" HorizontalAlignment="Left" Margin="150,50,0,0" VerticalAlignment="Top" Width="36" Height="26" FontSize="12" Foreground="White"/>
|
|
<Button TabIndex="4" x:Name="btnstop" Content="Stop" ToolTip="Taps the PowerButton of ITM" BorderThickness="0" HorizontalAlignment="Left" Margin="11,86,0,0" VerticalAlignment="Top" Width="111" Height="26" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
|
|
<Button.Resources>
|
|
<Style TargetType="{x:Type Border}">
|
|
<Setter Property="CornerRadius" Value="2"/>
|
|
</Style>
|
|
</Button.Resources>
|
|
</Button>
|
|
<Button TabIndex="4" x:Name="btninspect" Content="Inspect" ToolTip="Taps the PowerButton of ITM" BorderThickness="0" HorizontalAlignment="Left" Margin="11,117,0,0" VerticalAlignment="Top" Width="111" Height="26" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
|
|
<Button.Resources>
|
|
<Style TargetType="{x:Type Border}">
|
|
<Setter Property="CornerRadius" Value="2"/>
|
|
</Style>
|
|
</Button.Resources>
|
|
</Button>
|
|
<TextBox Name="log" Text="" BorderThickness="0" HorizontalAlignment="Left" Height="340" Margin="133,54,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="369" HorizontalContentAlignment="Center" Background="#013C5A" Foreground="White" FontSize="14" IsTabStop="False"/>
|
|
<Label x:Name="l2_Kopieren1" Content="FQDN:" HorizontalAlignment="Left" Margin="10,224,0,0" VerticalAlignment="Top" Width="73" Height="26" FontSize="12" Foreground="White"/>
|
|
<Label x:Name="l2_Kopieren2" Content="BIOS Version:" HorizontalAlignment="Left" Margin="10,184,0,0" VerticalAlignment="Top" Width="84" Height="26" FontSize="12" Foreground="White"/>
|
|
<TextBox x:Name="log_Power" Text="" BorderThickness="0" HorizontalAlignment="Left" Height="18" Margin="11,170,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="111" HorizontalContentAlignment="Center" Background="#013C5A" Foreground="White" FontSize="14" IsTabStop="False"/>
|
|
<TextBox x:Name="log_BIOS" Text="" BorderThickness="0" HorizontalAlignment="Left" Height="18" Margin="11,208,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="111" HorizontalContentAlignment="Center" Background="#013C5A" Foreground="White" FontSize="14" IsTabStop="False"/>
|
|
<TextBox x:Name="log_MAC" Text="" BorderThickness="0" HorizontalAlignment="Left" Height="18" Margin="10,248,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="112" HorizontalContentAlignment="Center" Background="#013C5A" Foreground="White" FontSize="14" IsTabStop="False"/>
|
|
</Grid>
|
|
</Window>
|
|
"@
|
|
|
|
# Lädt das Fenster
|
|
$NR=(New-Object System.Xml.XmlNodeReader $Form)
|
|
$window=[Windows.Markup.XamlReader]::Load($NR)
|
|
|
|
# Objekt - Variablen Verknüpfung
|
|
|
|
$Script:r710_btn_start = $window.FindName("btnstart")
|
|
$Script:r710_btn_stop = $window.FindName("btnstop")
|
|
$Script:r710_btn_inspect = $window.FindName("btninspect")
|
|
$Script:r710ok = $window.findName("btnok")
|
|
$Env:r710_log_power = $window.findName("log_Power")
|
|
$Env:r710_log_bios = $window.findName("log_BIOS")
|
|
$Env:r710_log_mac = $window.findName("log_MAC")
|
|
$Script:r710_log = $window.findName("log")
|
|
|
|
# Verknüpft feste Elemente
|
|
$window.Title = $Script:Version
|
|
$window.icon="$root/Source/Logo.png"
|
|
return $window
|
|
}
|
|
|
|
$Script:r710 = Load_r710 $args[0] # Variable: $r710
|
|
#$Script:Timestamp = get-date -format "yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
|
|
|
$r710.Add_MouseLeftButtonDown({
|
|
$r710.DragMove()
|
|
})
|
|
|
|
$r710_btn_start.Add_Click({
|
|
Write-Admin-Log "BTN r710 start pressed"
|
|
if (confirm "Server R710 wird durch erneute betätigung gestartet") {
|
|
cd $racpath
|
|
$r710_log.Text += $(.\racadm.exe -r spaeth-bayern.de:5005 -u root -p "kt}y/6ZHF~.@" serveraction powerup)
|
|
}
|
|
})
|
|
|
|
$r710_btn_stop.Add_Click({
|
|
Write-Admin-Log "BTN r710 stop pressed"
|
|
if (confirm "Server R710 wird durch erneute betätigung gestopt`n`nSind alle Virtuelle Maschinen ausgeschaltet?") {
|
|
cd $Script:racpath
|
|
$r710_log.Text += $(.\racadm.exe -r spaeth-bayern.de:5005 -u root -p "kt}y/6ZHF~.@" serveraction powerdown)
|
|
}
|
|
})
|
|
|
|
$r710_btn_inspect.Add_Click({
|
|
Write-Admin-Log "BTN r710 inspect pressed"
|
|
if (confirm "Server R710 wird durch erneute betätigung gestopt`n`nSind alle Virtuelle Maschinen ausgeschaltet?") {
|
|
cd $Script:racpath
|
|
$collection = $(.\racadm.exe -r spaeth-bayern.de:5005 -u root -p "kt}y/6ZHF~.@" getsysinfo)
|
|
foreach ($item in $collection) {
|
|
if ($null -ne $item) {
|
|
$r710_log.Text += "$item`n"
|
|
if($item -match "DNS RAC Name"){
|
|
$index = ($item.IndexOf("="))
|
|
$Script:r710_log_mac.Text = $item.Substring($index+1)
|
|
}
|
|
if($item -match "Firmware Version"){
|
|
$index = ($item.IndexOf("="))
|
|
$Script:r710_log_bios.Text = $item.Substring($index+1)
|
|
}
|
|
if($item -match "Power Status"){
|
|
$index = ($item.IndexOf("="))
|
|
$Script:r710_log_power.Text = $item.Substring($index+1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
$r710ok.Add_Click({
|
|
$r710.Hide()
|
|
})
|