Nein gibt es nicht. Es ist auch nicht so programmiert das es für andere Leute möglich wäre den Code komfortabel zu nutzen und anzupassen. Zudem gibt es ein paar Funktionen die nur für unsere Firma interessant sind.
Code: Select all
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
#Form
$myGui = New-Object System.Windows.Forms.Form
$myGui.StartPosition = "CenterScreen"
$myGui.Size = New-Object System.Drawing.Size(800,1132)
$myGui.Text = "Firma Support Tools"
# Add Favicon
#$Icon = New-Object system.drawing.icon ("\\....")
$myGui.Icon = $Icon
$myGui.MaximizeBox = $False
# add Backgroud Image
#$imgCBLogo = [system.drawing.image]::FromFile("\\....")
#$myGui.BackgroundImage = $imgCBLogo
#$myGui.BackgroundImageLayout = "Center"
#Label für die Ausgabe
$lblAusgabe = New-Object System.Windows.Forms.Label
$lblAusgabe.Location = New-Object System.Drawing.Size(300,110)
$lblAusgabe.BackColor = "Transparent"
$lblAusgabe.Size = New-Object System.Drawing.Size(490,400)
$lblAusgabe.Text = ""
$myGui.Controls.Add($lblAusgabe)
#Label Werkzeuge:
$lblSelbstTest = New-Object System.Windows.Forms.Label
$lblSelbstTest.Location = New-Object System.Drawing.Size(5,90)
$lblSelbstTest.Font = new-object System.Drawing.Font("Times New Roman", 12, [System.Drawing.FontStyle]::Underline);
$lblSelbstTest.AutoSize = $true
$lblSelbstTest.BackColor = "Transparent"
$lblSelbstTest.Text = "Werkzeuge:"
$myGui.Controls.Add($lblSelbstTest)
#Button Internet-Anbindung testen
$bTestInternet = New-Object System.Windows.Forms.Button
$bTestInternet.Location = New-Object System.Drawing.Size(5,120)
$bTestInternet.AutoSize = $true
$bTestInternet.Font = new-object System.Drawing.Font("Verdana", 12);
$bTestInternet.BackColor = "Orange"
$bTestInternet.Text = "Internet-Anbindung testen"
$bTestInternet.Add_Click({
$lblAusgabe.Font = new-object System.Drawing.Font("Verdana", 16);
ping -n 1 google.de | find '"TTL"' > $nul;
if($lastexitcode -eq 0){
$lblAusgabe.Text="Internet ist erreichbar.";
$lblAusgabe.ForeColor = "green";
}
else{
$lblAusgabe.ForeColor = "red";
$lblAusgabe.Text="Internet ist nicht erreichbar."
}
})
$myGui.Controls.Add($bTestInternet)
#Button Netzwerk-Anbindung testen"
$bTestIntranet = New-Object System.Windows.Forms.Button
$bTestIntranet.Location = New-Object System.Drawing.Size(5,160)
$bTestIntranet.Font = new-object System.Drawing.Font("Verdana", 12);
$bTestIntranet.Size = New-Object System.Drawing.Size(300,60)
$bTestIntranet.BackColor = "Orange"
$bTestIntranet.Text = "... Netzwerk-Anbindung testen"
$bTestIntranet.Add_Click({
$lblAusgabe.Font = new-object System.Drawing.Font("Verdana", 16);
ping -n 1 192.168.100.254 | find '"TTL"' > $nul;
if($lastexitcode -eq 0){
$lblAusgabe.Text="... Netzwerk ist erreichbar.";
$lblAusgabe.ForeColor = "green";
}
else{
$lblAusgabe.ForeColor = "red";
$lblAusgabe.Text="... Netzwerk ist nicht erreichbar."
}
})
$myGui.Controls.Add($bTestIntranet)
#Button F:Data-Verzeichnis anlegen
$bDataVer = New-Object System.Windows.Forms.Button
$bDataVer.Location = New-Object System.Drawing.Size(5,220)
$bDataVer.Font = new-object System.Drawing.Font("Verdana", 12);
$bDataVer.Size = New-Object System.Drawing.Size(300,50)
$bDataVer.BackColor = "Orange"
$bDataVer.Text = "F:Data-Verzeichnis anlegen"
$bDataVer.Add_Click({
$lblAusgabe.Text = "In Bearbeitung..."
$return = net use F: \\192.168.100.4\Data | out-string
$lblAusgabe.Font = new-object System.Drawing.Font("Verdana", 16);
if($lastexitcode -eq 0){
$lblAusgabe.ForeColor = "green";
$lblAusgabe.Text = $return
}
else{
$lblAusgabe.ForeColor = "red";
$lblAusgabe.Text = "Es ist ein Fehler aufgetreten. Ordner ist schon als Laufwerk F gemappt oder Server ist nicht ereichbar."
}
})
$myGui.Controls.Add($bDataVer)
#Label Für den Support
$lblSupp = New-Object System.Windows.Forms.Label
$lblSupp.Location = New-Object System.Drawing.Size(5,270)
$lblSupp.Font = new-object System.Drawing.Font("Times New Roman", 12, [System.Drawing.FontStyle]::Underline);
$lblSupp.AutoSize = $true
$lblSupp.BackColor = "Transparent"
$lblSupp.Text = "Für den Support:"
$myGui.Controls.Add($lblSupp)
#Button IP-Anzeigen
$bIPAdresse = New-Object System.Windows.Forms.Button
$bIPAdresse.Location = New-Object System.Drawing.Size(5,300)
$bIPAdresse.Font = new-object System.Drawing.Font("Verdana", 12);
$bIPAdresse.AutoSize = $true
$bIPAdresse.BackColor = "Orange"
$bIPAdresse.Text = "IP-Anzeigen"
$bIPAdresse.Add_Click({
$lblAusgabe.Font = new-object System.Drawing.Font("Verdana", 16);
$x = GWMI -cl "Win32_NetworkAdapterConfiguration" -name "root\CimV2" -comp localhost -filter "IpEnabled = TRUE" | Select-Object Description,IPAddress,IPSubnet | fl
$x = $x | out-string
$lblAusgabe.Text=$x
})
$myGui.Controls.Add($bIPAdresse)
#Button Computername anzeigen
$bHostname = New-Object System.Windows.Forms.Button
$bHostname.Location = New-Object System.Drawing.Size(5,340)
$bHostname.Font = new-object System.Drawing.Font("Verdana", 12);
$bHostname.AutoSize = $true
$bHostname.BackColor = "Orange"
$bHostname.Text = "Computername anzeigen"
$bHostname.Add_Click({
$lblAusgabe.Font = new-object System.Drawing.Font("Verdana", 16);
$return = hostname | out-string
$lblAusgabe.ForeColor = "green"
$lblAusgabe.Text = "Computername:" + $return
})
$myGui.Controls.Add($bHostname)
####Label Ticket einreichen
$lblTicket = New-Object System.Windows.Forms.Label
$lblTicket.Location = New-Object System.Drawing.Size(5,390)
$lblTicket.Font = new-object System.Drawing.Font("Verdana", 12);
$lblTicket.AutoSize = $true
$lblTicket.BackColor = "Transparent"
$lblTicket.Text = "Ticket einreichen"
$myGui.Controls.Add($lblTicket)
####Label Abteilung
$lblAbteilung = New-Object System.Windows.Forms.Label
$lblAbteilung.Location = New-Object System.Drawing.Size(5,420)
$lblAbteilung.Font = new-object System.Drawing.Font("Verdana", 10);
$lblAbteilung.AutoSize = $true
$lblAbteilung.BackColor = "Transparent"
$lblAbteilung.Text = "Abteilung:"
$myGui.Controls.Add($lblAbteilung)
#####Combobox Abteilung
$cbAbteilung = New-Object System.Windows.Forms.Combobox
$cbAbteilung.Location = New-Object System.Drawing.Size(118,420)
$cbAbteilung.Size = New-Object System.Drawing.Size(185,20)
[void] $cbAbteilung.Items.Add("Qualitaetssicherung")
[void] $cbAbteilung.Items.Add("Buchhaltung")
[void] $cbAbteilung.Items.Add("Marketing")
[void] $cbAbteilung.Items.Add("Research")
$cbAbteilung.Height = 70
$myGui.Controls.Add($cbAbteilung)
####Label Kategorie
$lblKategorie = New-Object System.Windows.Forms.Label
$lblKategorie.Location = New-Object System.Drawing.Size(5,450)
$lblKategorie.Font = new-object System.Drawing.Font("Verdana", 10);
$lblKategorie.AutoSize = $true
$lblKategorie.BackColor = "Transparent"
$lblKategorie.Text = "Kategorie:"
$myGui.Controls.Add($lblKategorie)
####Combobox Kategorie
$cbKategorie = New-Object System.Windows.Forms.Combobox
$cbKategorie.Location = New-Object System.Drawing.Size(118,450)
$cbKategorie.Size = New-Object System.Drawing.Size(185,20)
[void] $cbKategorie.Items.Add("Allgemein")
[void] $cbKategorie.Items.Add("DMS")
[void] $cbKategorie.Items.Add("Exchange und E-Mail")
[void] $cbKategorie.Items.Add("Software")
$cbKategorie.Height = 70
$myGui.Controls.Add($cbKategorie)
####Label Auswirkung
$lblAuswirkung = New-Object System.Windows.Forms.Label
$lblAuswirkung.Location = New-Object System.Drawing.Size(5,480)
$lblAuswirkung.Font = new-object System.Drawing.Font("Verdana", 10);
$lblAuswirkung.AutoSize = $true
$lblAuswirkung.BackColor = "Transparent"
$lblAuswirkung.Text = "Auswirkung:"
$myGui.Controls.Add($lblAuswirkung)
####Combobox Auswirkung
$cbAuswirkung = New-Object System.Windows.Forms.Combobox
$cbAuswirkung.Location = New-Object System.Drawing.Size(118,480)
$cbAuswirkung.Size = New-Object System.Drawing.Size(185,20)
[void] $cbAuswirkung.Items.Add("Leichter Fehler")
[void] $cbAuswirkung.Items.Add("Schwerer Fehler")
[void] $cbAuswirkung.Items.Add("Feature / Wunsch")
[void] $cbAuswirkung.Items.Add("Hilfe")
$cbAuswirkung.Height = 70
$myGui.Controls.Add($cbAuswirkung)
####Label Zusammenfassung
$lblZusammenfassung = New-Object System.Windows.Forms.Label
$lblZusammenfassung.Location = New-Object System.Drawing.Size(5,510)
$lblZusammenfassung.Size = New-Object System.Drawing.Size(300,30)
$lblZusammenfassung.BackColor = "Transparent"
$lblZusammenfassung.Text = "Kuzbeschreibung (z.B. Notebook absturz oder Software installieren, Fehler(..)"
$myGui.Controls.Add($lblZusammenfassung)
####Textbox Zusammenfassung
$tbZusammenfassung = New-Object System.Windows.Forms.TextBox
$tbZusammenfassung.Location = New-Object System.Drawing.Size(5,540)
$tbZusammenfassung.Size = New-Object System.Drawing.Size(400,20)
$myGui.Controls.Add($tbZusammenfassung)
####Label Beschreibung des Problems/Anliegens
$lblBeschreibung = New-Object System.Windows.Forms.Label
$lblBeschreibung.Location = New-Object System.Drawing.Size(5,565)
$lblBeschreibung.Size = New-Object System.Drawing.Size(300,25)
$lblBeschreibung.BackColor = "Transparent"
$lblBeschreibung.Text = "Beschreibung des Problems/Anliegens"
$myGui.Controls.Add($lblBeschreibung)
####Textbox Beschreibung
$tbBeschreibung = New-Object System.Windows.Forms.TextBox
$tbBeschreibung.Location = New-Object System.Drawing.Size(5,590)
$tbBeschreibung.Size = New-Object System.Drawing.Size(300,200)
$tbBeschreibung.Multiline = $true
$tbBeschreibung.WordWrap = $true
$myGui.Controls.Add($tbBeschreibung)
####Button Ticket abschicken
$bTicketSenden = New-Object System.Windows.Forms.Button
$bTicketSenden.BackColor = "Transparent"
$bTicketSenden.Location = New-Object System.Drawing.Size(75,800)
$bTicketSenden.Size = New-Object System.Drawing.Size(180,25)
$bTicketSenden.Text = "Ticket abschicken"
$bTicketSenden.Add_Click({
if(($tbBeschreibung.Text -ne "") -and ($tbZusammenfassung.Text -ne "") -and ($cbAbteilung.Text -ne "") -and ($cbAuswirkung.Text -ne "") -and ($cbKategorie.Text -ne "")){
$lblTicketStatus.Text = "Ticket wird erstellt...."
$mantis = New-WebServiceProxy -Uri http://mantis/mantis/api/soap/mantisconnect.php?wsdl
$issue = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.IssueData
$project = new-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.ObjectRef
$severity = new-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.ObjectRef
switch($cbAbteilung.Text){
"Qualitaetssicherung" {$project.id = 1}
"Marketing" {$project.id = 3}
"Research" {$project.id = 6}
"Buchhaltng" {$project.id = 5}
}
switch($cbAuswirkung.Text){
"Hilfe" {$severity.id = 90}
"Leichter Fehler" {$severity.id = 50}
"Schwerer Fehler" {$severity.id = 60}
"Feature / Wunsch" {$severity.id = 10}
}
$issue.project = $project
$issue.summary = $tbZusammenfassung.Text
$issue.description = $tbBeschreibung.Text
$issue.description = -join ($issue.description, "`r`nGenerierte Infos:", (systeminfo | out-string))
$x = Get-Eventlog system -newest 10 -EntryType Warning,Error | fl
$issue.description = -join ($issue.description,"`r`nSYSTEM-LOG:",$x | out-string)
$x = Get-Eventlog application -newest 10 -EntryType Warning,Error | fl
$issue.description = -join ($issue.description,"`r`nAPPLICATION-LOG:",$x | out-string)
$issue.severity = $severity
$issue.category = $cbKategorie.Text
$response = $mantis.mc_issue_add("Benutzername","Passwort",$issue)
$lblTicketStatus.Text = "Ticket mit der ID:" + $response + " erstellt.`r`nHinweis:Sollte keine ID angezeigt werden,`r`nhat es nicht funktioniert."
$tbZusammenfassung.Text = ""
$tbBeschreibung.Text = ""
}
else{
[System.Windows.Forms.MessageBox]::Show("Alle Felder müssen ausgefüllt werden.")
$lblTicketStatus.Text = "Erstellung abgebrochen...."
$tbZusammenfassung.Text = ""
$tbBeschreibung.Text = ""
}
})
$myGui.Controls.Add($bTicketSenden)
####Label Ticket Status
$lblTicketStatus = New-Object System.Windows.Forms.Label
$lblTicketStatus.Location = New-Object System.Drawing.Size(5,830)
$lblTicketStatus.BackColor = "Transparent"
$lblTicketStatus.Size = New-Object System.Drawing.Size(300,45)
$lblTicketStatus.Text = ""
$myGui.Controls.Add($lblTicketStatus)
[void] $myGui.ShowDialog()
Das Skript in einer .ps1 Datei einfügen und ausführen. Im letzten Abschnitt musst du mindestens die URL zu eurem Mantis Server anpassen und den Benutzernamen eines Reportes + Passwort hinterlegen.