Files
FS_Admin_Panel/root.ps1
Florian Späth afb2f418fc init
2025-01-31 01:49:31 +01:00

86 lines
2.9 KiB
PowerShell

$Script:Version = "FS Admin Panel v0.8"
#Ersteller: Florian Späth
#Diese Software soll helfen die verschiedensten Anwendungen und Scripte der FG HDS zu administrieren.
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null
#### Lädt Scripte ####
. $PSScriptRoot\GUIS\main.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\info.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\gaming.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\r710.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\confirm.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\cleartmp.ps1 $PSSCriptRoot
. $PSScriptRoot\GUIS\getlogs.ps1 $PSSCriptRoot
. $PSSCriptRoot\GUIS\confirm.ps1 $PSScriptRoot
#### Definition globaler Variablen ####
## Die GO variable kann nach aufruf der confirm funktion abgefragt werden, um eine 2. Bestätigung der eingabe zu erhalten. (Aufruf: confirm $text)
[boolean]$Script:GO = $false
$Script:ScriptRoot = $PSScriptRoot
$Script:iconpath = "$PSScriptRoot\icons"
$Script:config = Import-CSV -Path "$PSScriptRoot\config.csv"
$Script:RACpath = ($config | where{$_.ID -eq "racadm_path"}).value
$Script:plinkpath = ($config | where{$_.ID -eq "plink_path"}).value
#$Script:cert_path = ($config | where{$_.ID -eq "some"}).value
#$Script:defudbu_path = ($config | where{$_.ID -eq "some"}).value
$logfile = "$PSScriptRoot\log.txt"
### Farb Variablen ###
$Script:Standardbtncolor = "#00b8d4"
$Script:Delcolor = "#d50000"
$Script:BackgroundMovecolor = "#FFFFEB9C"
$Script:ForegroundMovecolor = "#FF9C6500"
$Script:Foregroundgrey = "#FF7A7A7A"
$Script:Backgroundgrey = "#FFC5C5C5"
#### Funktionen ####
### Global ###
function Write-Admin-Log{
Param($text)
"$(get-date -format "yyyy-MM-dd HH:mm:ss"): $($text)" | out-file $logfile -Append
$main_log.content += "$text `n"
}
function Resolve-DnsName {
param (
[Parameter(Mandatory)][string]$ComputerName
)
try {
[System.Net.Dns]::GetHostAddresses($ComputerName).IPAddressToString
return ([System.Net.Dns]::GetHostAddresses($ComputerName).IPAddressToString)
}
catch {
Write-Log "IP not found for $ComputerName!"
}
}
Function Select-FolderDialog{
param([string]$Description="Zielverzeichnis wählen",[string]$RootFolder="Desktop")
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null
$objForm = New-Object System.Windows.Forms.FolderBrowserDialog
$objForm.Rootfolder = $RootFolder
$objForm.Description = $Description
$Show = $objForm.ShowDialog()
If ($Show -eq "OK"){
Return $objForm.SelectedPath
}else{
Return $false
}
}
#### Startet die Anwendung ####
### Initialisieren ###
### Öffnet erstes Fenster ###
Write-Admin-Log "##### OPEN MAIN WINDOW #####"
$main.ShowDialog() | Out-Null