questionmark93
Goto Top

Programm öffnen - Taskmgr

Hallo Leute =)

Wie kann ich ein Programm über den Taskmanager starten; für einen anderen Benutzer
(so wie ich ein Programm schließen kann, muss ich es ja auch irgendwie öffnen können)

Ich bin der Admin und möchte Outlook bei jemand anderem starten.

Vielen Dank schon einmal im Voraus =)

Content-Key: 249231

Url: https://administrator.de/contentid/249231

Ausgedruckt am: 29.03.2024 um 15:03 Uhr

Mitglied: xbast1x
xbast1x 15.09.2014 um 16:07:46 Uhr
Goto Top
Spontan würde ich die .exe direkt im Windows starten.

Im Taskmanager, würde ich meinen Ausführen als -> dann öffnen und Neuen Task starten
Mitglied: Questionmark93
Questionmark93 15.09.2014 um 16:11:19 Uhr
Goto Top
soweit war ich schon, aber das es für einen anderen Benutzer aufgeht.

Ich sende eine Mail im Netzwerk.
Schaue die Prozesse an und sehe das Outlook nicht läuft.
Ich will Outlook bei einem anderen öffnen, das die Mail
gelesen wird.

So meine ich das.
Mitglied: ITvortex
ITvortex 15.09.2014 um 16:20:26 Uhr
Goto Top
Also verstehe ich dich richtig wenn ich annehme das du von deinem Server (?) über den Taskmanager bei einem User irgendwo auf einem PC über das Netzwerk Outlook starten willst??
Mitglied: Phalanx82
Phalanx82 15.09.2014 um 17:08:01 Uhr
Goto Top
Hallo,

3 Möglichkeiten:

1. Outlook in den Autostart packen

2. Arbeitsanweisung an alle ausgeben dass Outlook regelmäßig auf Mails zu prüfen ist.

3. wenns was wichtiges ist, anrufen. Mails sind Nicht wichtig ;)


Mfg.
Mitglied: DerWoWusste
DerWoWusste 15.09.2014 um 19:00:43 Uhr
Goto Top
Damit das in dessen Namen interaktiv gestartet wird, erstelle einen geplanten Task und gib als ausführendes Konto ihn an und setz' den Haklen bei "nur ausführen wenn angemeldet", starte dann den Task. Ein anderer Weg will mir gerade nicht einfallen.
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 08:04:19 Uhr
Goto Top
Zitat von @ITvortex:

Also verstehe ich dich richtig wenn ich annehme das du von deinem Server (?) über den Taskmanager bei einem User irgendwo auf
einem PC über das Netzwerk Outlook starten willst??

Ja genau das meine ich, gibt es für den Taskmgr keine parameter oder so?
Mitglied: skahle85
skahle85 16.09.2014 um 11:13:03 Uhr
Goto Top
Schonmal die PsTools verwendet / probiert?

http://technet.microsoft.com/de-de/sysinternals/bb896649.aspx

Gruß
Mitglied: skahle85
skahle85 16.09.2014 um 11:53:44 Uhr
Goto Top
Ach und ansonsten würde ich das klassische Anmeldescript per GPO empfehlen.
Mitglied: DerWoWusste
Lösung DerWoWusste 16.09.2014 aktualisiert um 13:21:17 Uhr
Goto Top
Es geht ja nicht um Autostart, sondern um on-demand-start in eine andere Sitzung hinein. Mein Taskansatz löst das, mit psexec geht das evtl. auch mit dem Schalter -i.
Mitglied: ITvortex
Lösung ITvortex 16.09.2014 aktualisiert um 13:21:21 Uhr
Goto Top
Mit psexec geht es auch.
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 13:21:49 Uhr
Goto Top
Danke genau das wollte ich =)
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 13:26:14 Uhr
Goto Top
eine Frage noch, wie genau lautet der befehl? =)

Programm: Outlook.exe
Benutzer: Andre
Programmpfad: C:\Program Files (x86)\Microsoft Office\Office14
Mitglied: ITvortex
ITvortex 16.09.2014 um 13:57:45 Uhr
Goto Top
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 14:10:32 Uhr
Goto Top
ja da war ich schon aber ich versteh das nicht :D
ich bin darin noch nicht so der Experte was die cmd
betrifft
Mitglied: ITvortex
ITvortex 16.09.2014 um 14:15:38 Uhr
Goto Top
Outlook starten

psexec.exe \\<Remotecomputer> -u <Benutzername> -p <Kennwort> <Programm>

Wenn es eine Datei sein soll.

Psexec [\\<Computer>| @<Datei> -u <Benutzername> -p <Kennwort>
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 14:25:36 Uhr
Goto Top
psexec.exe \\<andre-w-pc> -u <andre> <outlook.exe> ? so?
Mitglied: ITvortex
ITvortex 16.09.2014 aktualisiert um 14:30:16 Uhr
Goto Top
Du musst schon angeben wo "outlook.exe" exe liegt, und die Tags (<,>) sind nur als Platzhalter gedacht.

psexec \\Computername -u Benutzername -p Kennwort Programmpfad
Mitglied: ITvortex
ITvortex 16.09.2014 aktualisiert um 14:34:56 Uhr
Goto Top
PsExec.exe \\Martin-PC -u Martin -p testPasswort C:\Users\Martin\Desktop\"Mein Programmordner"\test.exe  

so bitte.

Berechtigungen müssen natürlich da sein, sonst bekommst du "Zugriff verweigert"

Liebe Grüße

Martin
Mitglied: DerWoWusste
Lösung DerWoWusste 16.09.2014 aktualisiert um 15:03:19 Uhr
Goto Top
Ach so...Du kennst also alle Benutzerkennwörter face-smile face-smile
Nee, mach es mit -i, ganz ohne -u und -p.
Mitglied: ITvortex
Lösung ITvortex 16.09.2014 aktualisiert um 15:03:23 Uhr
Goto Top
@DerWoWusste Das ist richtig, die Benutzerkennwörter benötigst du bei der obigen Version, hab nich dran gedacht danke face-wink

 PsExec.exe -i \\Computername C:\Programmordner\irgendeinProgramm.exe

Ohne Userdaten. Die Berechtigungen für den Zugriff musst du natürlich haben.

Gruß face-wink
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 15:03:56 Uhr
Goto Top
Perfekt Danke, so wollte ich das face-smile)

Danke euch =)
Mitglied: Questionmark93
Questionmark93 16.09.2014 um 15:11:24 Uhr
Goto Top
Kann ich das ganze auch mit VBA machen?

Sprich ich mache ein Skript mit (Bitte geben Sie einen Benutzer ein) und er sucht mir den Computername aus einer Liste
und ein Skript mit (Bitte wählen Sie ein Programm aus) und er sucht mir ein Proramm raus von den Pfaden die in einer Liste angegeben sind?
Mitglied: 117455
117455 16.09.2014 um 19:56:16 Uhr
Goto Top
Ohne die < und >
Mitglied: ITvortex
ITvortex 17.09.2014 um 08:43:02 Uhr
Goto Top
Du kannst schon, nur ob das nicht overkill für deine Andorderung wäre?

Gruß
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 08:47:09 Uhr
Goto Top
:D ou man

naja okay dann eben nicht
Mitglied: skahle85
skahle85 17.09.2014 um 08:47:24 Uhr
Goto Top
Alles kann, nichts muss :D.

Wie gut kennst du dich denn mit der Powershell + GUI aus?
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 08:49:14 Uhr
Goto Top
mh eher weniger gut deswegen frag ich hier ^^

ich wollte es eig mit Bordmitteln schaffen xD
Mitglied: ITvortex
ITvortex 17.09.2014 um 08:52:09 Uhr
Goto Top
Ja dann musst du dich selbst einlesen, ich weiß nicht ob @colinardo wieder mal bock hat, aber ich hab leider nicht die Zeit um dir as Skript zu schreiben.
Mitglied: skahle85
skahle85 17.09.2014 um 09:04:46 Uhr
Goto Top
Ist gleich fertig... :D
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 09:18:20 Uhr
Goto Top
ja glaube ich, für jemanden der das immer macht :P
Mitglied: skahle85
skahle85 17.09.2014 um 10:24:38 Uhr
Goto Top
So,

hier ist mal der Anfang des bösen :D. Starte mal die Powershell ISE und füge den Code ein. Kopier dir mal vorher die PsExec.exe nach System32.
Leider fehlt noch irgendwas und ich komm gerade nicht drauf. Vielleicht hat ja jemand noch den passende kniff am Start...
Muss erstmal zurück an die Arbeit und schau im laufe des Tages nochmal rein.

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")   
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")  #loading the necessary .net libraries (using void to suppress output)  

###################################################################################################################################################
# - WINDOWS FORMS & LABELS -                                                                                                                      #
###################################################################################################################################################
$Form = New-Object System.Windows.Forms.Form    #creating the form (this will be the "primary" window)  
$Form.Size = New-Object System.Drawing.Size(700,400)  #the size in px of the window length, height
Add-Type -AssemblyName System.Windows.Forms
#$Image = [system.drawing.image]::FromFile("$($env:windir)\water.jpg")   
#$Form.BackgroundImage = $Image
#$Form.BackgroundImageLayout = "Stretch" # None, Tile, Center, Stretch, Zoom  
$Form.StartPosition = "CenterScreen" #loads the window in the center of the screen  
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow #modifies the window border
$Form.Text = "User Programs" #window description  

###################################################################################################################################################
# - Begin LABELS -                                                                                                                                #
###################################################################################################################################################
#Label Client
$Labelwks = New-Object System.Windows.Forms.Label
$Font = New-Object System.Drawing.Font("Times New Roman",9,[System.Drawing.FontStyle]::Bold) # Font styles are: Regular, Bold, Italic, Underline, Strikeout  
$Labelwks.Font = $Font
$Labelwks.Text = "Client with \\"  
$Labelwks.Location = New-Object System.Drawing.Size(10,45)
$Labelwks.BackColor = "Transparent"  
#Label Program
$LabelProg = New-Object System.Windows.Forms.Label
$Font = New-Object System.Drawing.Font("Times New Roman",9,[System.Drawing.FontStyle]::Bold) # Font styles are: Regular, Bold, Italic, Underline, Strikeout  
$LabelProg.Font = $Font
$LabelProg.Text = "Path to Program"  
$LabelProg.Location = New-Object System.Drawing.Size(180,45)
$LabelProg.BackColor = "Transparent"  

###################################################################################################################################################
# - END WINDOWS FORMS & LABELS -                                                                                                                  #
###################################################################################################################################################


###################################################################################################################################################
# - BEGIN FUNKTIONS -                                                                                                                             #
###################################################################################################################################################
#####################
# - FUNCTION PSEXEC - #
#####################
function pingInfo {
$Prog=$InputBoxProg.text;
$wks=$InputBoxWKS.text; #takes the text from the input box into the variable $wks
$ProgResult=PsExec.exe -i /acceptEula \\$wks $Prog | fl | out-string;
$outputBox.text=$ProgResult #send the ping results to the output box

}

###################################################################################################################################################
# - BEGIN TEXTFIELDS INPUT -                                                                                                                      #
###################################################################################################################################################

#Input
$InputBoxWKS = New-Object System.Windows.Forms.TextBox #creating the text box
$InputBoxWKS.Location = New-Object System.Drawing.Size(10,60) #location of the text box (px) in relation to the primary window's edges (length, height)  
$InputBoxWKS.Size = New-Object System.Drawing.Size(150,20) #the size in px of the text box (length, height)
$Form.Controls.Add($InputBoxWKS) #activating the text box inside the primary window

#Input Username
$InputBoxProg = New-Object System.Windows.Forms.TextBox #creating the text box
$InputBoxProg.Location = New-Object System.Drawing.Size(180,60) #location of the text box (px) in relation to the primary window's edges (length, height)  
$InputBoxProg.Size = New-Object System.Drawing.Size(150,20) #the size in px of the text box (length, height)
$Form.Controls.Add($InputBoxProg) #activating the text box inside the primary window

###################################################################################################################################################
# - END TEXTFIELDS INPUT -                                                                                                                        #
###################################################################################################################################################
#/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#
###################################################################################################################################################
# - BEGIN TEXTFIELDS OUTPUT -                                                                                                                     #
###################################################################################################################################################
#Outputbox 
$outputBox = New-Object System.Windows.Forms.TextBox #creating the text box
$outputBox.Location = New-Object System.Drawing.Size(10,90) #location of the text box (px) in relation to the primary window's edges (length, height)  
$outputBox.Size = New-Object System.Drawing.Size(490,280) #the size in px of the text box (length, height)
$outputBox.MultiLine = $True #declaring the text box as multi-line
$outputBox.ScrollBars = "Vertical" #adding scroll bars if required  
$outputBox.Font = New-Object System.Drawing.Font("Verdana",8,[System.Drawing.FontStyle]::Italic) #Textbox Font  
$Form.Controls.Add($outputBox) #activating the text box inside the primary window
###################################################################################################################################################
# - END TEXTFIELDS OUTPUT -                                                                                                                       #
###################################################################################################################################################
#/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#
###################################################################################################################################################
# - BEGIN BUTTONS -                                                                                                                               #
###################################################################################################################################################

#Button Ping
$ButtonPing = New-Object System.Windows.Forms.Button #create the button
$ButtonPing.Location = New-Object System.Drawing.Size(10,10) #location of the button (px) in relation to the primary window's edges (length, height)  
$ButtonPing.Size = New-Object System.Drawing.Size(100,23) #the size in px of the button (length, height)
$ButtonPing.Text = "Execute" #labeling the button  
$ButtonPing.Cursor = [System.Windows.Forms.Cursors]::Hand
$ButtonPing.BackColor = [System.Drawing.Color]::White
$ButtonPing.Font = New-Object System.Drawing.Font ("Verdana",10, [System.Drawing.FontStyle]::Regular)  
$ButtonPing.Add_Click({}) #the action triggered by the button
$Form.Controls.Add($ButtonPing) #activating the button inside the primary window
$ButtonPing.Add_Click({pingInfo})

#Exit Button
$ExitButton = New-Object System.Windows.Forms.Button #create the button
$ExitButton.Location = New-Object System.Drawing.Size(590,350) #location of the button (px) in relation to the primary window's edges (length, height)  
$ExitButton.Size = New-Object System.Drawing.Size(100,23) #the size in px of the button (length, height)
$ExitButton.Text = "Exit" #labeling the button  
$ExitButton.Add_Click({}) #the action triggered by the button
$Form.Controls.Add($ExitButton) #activating the button inside the primary window
$ExitButton.Add_Click({$Form.Close()})

###################################################################################################################################################
# - END BUTTONS -                                                                                                                                 #
###################################################################################################################################################


###################################################################################################################################################
# - LABELS -                                                                                                                                      #
###################################################################################################################################################

$Form.Controls.Add($Labelwks)
$Form.Controls.Add($LabelProg)

###################################################################################################################################################
# - ACTIVATE FORM -                                                                                                                                #
###################################################################################################################################################

[void] $Form.ShowDialog()
[void] $Form.Add_Shown({$Form.Activate()})
Mitglied: ITvortex
ITvortex 17.09.2014 um 11:01:14 Uhr
Goto Top
Wo liegt das Problem?

Geht doch, jedenfalls bei meinen Tests....

Gruß
Mitglied: skahle85
skahle85 17.09.2014 um 11:04:09 Uhr
Goto Top
Was???
Ok, Äää, thats the way ahaha i like it ahaha...
Mitglied: skahle85
skahle85 17.09.2014 um 11:06:22 Uhr
Goto Top
Zitat von @skahle85:

$ProgResult=PsExec.exe -i /acceptEula \\$wks $Prog | fl | out-string;
$outputBox.text=$ProgResult #send the ping results to the output box

da fehlt noch das "-d" argument damit es nicht aufs beenden wartet!
Mitglied: ITvortex
ITvortex 17.09.2014 aktualisiert um 11:09:44 Uhr
Goto Top
face-wink

Das einzige Problem bei der Funktion PsExec ist, das es Probleme geben kann wenn der User einen Pfad eingibt der Leerzeichen enthält: "C:\MeineProgramme\Mein Unterordner\test.exe".

Hiermit bekommst du eine Exception weil ihm die Hochkomata fehlen: "C:\MeineProgramme\"Mein Unterordner"\test.exe"

Und das -d fehlt zwecks Beenden..

Allerdings wollte er das ganze nicht nur grafisch, sondern auch eine Liste zum auswählen des Programmpfads des Users, aber wie gesagt das ist overkill. Ein paar Dinge könnte man noch anders lösen aber schönes Script.


Edit: Habe den Post zu spät gelesen ;)
Mitglied: skahle85
skahle85 17.09.2014 um 11:21:43 Uhr
Goto Top
Ja für ne Dropdown war ich jetzt nen bissl faul muss ich gestehen. Leider ist ja auch noch andere arbeit auf dem Tisch :/.
Mitglied: skahle85
skahle85 17.09.2014 aktualisiert um 12:28:22 Uhr
Goto Top
Edit: Ist noch ohne Dropdownlist ;)

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")   
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")  #loading the necessary .net libraries (using void to suppress output)  

###################################################################################################################################################
# - WINDOWS FORMS & LABELS -                                                                                                                      #
###################################################################################################################################################
$Form = New-Object System.Windows.Forms.Form    #creating the form (this will be the "primary" window)  
$Form.Size = New-Object System.Drawing.Size(800,400)  #the size in px of the window length, height
Add-Type -AssemblyName System.Windows.Forms
#$Image = [system.drawing.image]::FromFile("$($env:windir)\water.jpg")   
#$Form.BackgroundImage = $Image
#$Form.BackgroundImageLayout = "Stretch" # None, Tile, Center, Stretch, Zoom  
$Form.StartPosition = "CenterScreen" #loads the window in the center of the screen  
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow #modifies the window border
$Form.Text = "PsExec" #window description  

###################################################################################################################################################
# - Begin LABELS -                                                                                                                                #
###################################################################################################################################################
#Label Client
$Labelwks = New-Object System.Windows.Forms.Label
$Font = New-Object System.Drawing.Font("Times New Roman",9,[System.Drawing.FontStyle]::Bold) # Font styles are: Regular, Bold, Italic, Underline, Strikeout  
$Labelwks.Font = $Font
$Labelwks.Text = "Workstation"  
$Labelwks.Location = New-Object System.Drawing.Size(10,45)
$Labelwks.BackColor = "Transparent"  
#Label Program
$LabelProg = New-Object System.Windows.Forms.Label
$Font = New-Object System.Drawing.Font("Times New Roman",9,[System.Drawing.FontStyle]::Bold) # Font styles are: Regular, Bold, Italic, Underline, Strikeout  
$LabelProg.Font = $Font
$LabelProg.Text = "Path to Program"  
$LabelProg.Location = New-Object System.Drawing.Size(180,45)
$LabelProg.BackColor = "Transparent"  

###################################################################################################################################################
# - END WINDOWS FORMS & LABELS -                                                                                                                  #
###################################################################################################################################################


###################################################################################################################################################
# - BEGIN FUNKTIONS -                                                                                                                             #
###################################################################################################################################################
#####################
# - FUNCTION PSEXEC - #
#####################
function PsExec {
$Prog=$InputBoxProg.text;
$wks=$InputBoxWKS.text; #takes the text from the input box into the variable $wks
$ProgResult=PsExec.exe -i -d /acceptEula \\$wks "$Prog" 2>c:\bin\psexec.error.txt | fl | out-string -ErrorAction Stop;  
#$GetContent=c:\bin\psexec.error.txt;
$outputBox.text=Get-Content c:\bin\psexec.error.txt #send the ping results to the output box

}

###################################################################################################################################################
# - BEGIN TEXTFIELDS INPUT -                                                                                                                      #
###################################################################################################################################################

#Input
$InputBoxWKS = New-Object System.Windows.Forms.TextBox #creating the text box
$InputBoxWKS.Location = New-Object System.Drawing.Size(10,60) #location of the text box (px) in relation to the primary window's edges (length, height)  
$InputBoxWKS.Size = New-Object System.Drawing.Size(150,20) #the size in px of the text box (length, height)
$Form.Controls.Add($InputBoxWKS) #activating the text box inside the primary window

#Input Username
$InputBoxProg = New-Object System.Windows.Forms.TextBox #creating the text box
$InputBoxProg.Location = New-Object System.Drawing.Size(180,60) #location of the text box (px) in relation to the primary window's edges (length, height)  
$InputBoxProg.Size = New-Object System.Drawing.Size(150,20) #the size in px of the text box (length, height)
$Form.Controls.Add($InputBoxProg) #activating the text box inside the primary window

###################################################################################################################################################
# - END TEXTFIELDS INPUT -                                                                                                                        #
###################################################################################################################################################
#/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#
###################################################################################################################################################
# - BEGIN TEXTFIELDS OUTPUT -                                                                                                                     #
###################################################################################################################################################
#Outputbox 
$outputBox = New-Object System.Windows.Forms.TextBox #creating the text box
$outputBox.Location = New-Object System.Drawing.Size(10,90) #location of the text box (px) in relation to the primary window's edges (length, height)  
$outputBox.Size = New-Object System.Drawing.Size(670,280) #the size in px of the text box (length, height)
$outputBox.MultiLine = $True #declaring the text box as multi-line
$outputBox.ScrollBars = "Vertical" #adding scroll bars if required  
$outputBox.Font = New-Object System.Drawing.Font("Verdana",8,[System.Drawing.FontStyle]::Italic) #Textbox Font  
$Form.Controls.Add($outputBox) #activating the text box inside the primary window
###################################################################################################################################################
# - END TEXTFIELDS OUTPUT -                                                                                                                       #
###################################################################################################################################################
#/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#
###################################################################################################################################################
# - BEGIN BUTTONS -                                                                                                                               #
###################################################################################################################################################

#Button PsExec
$ButtonExec = New-Object System.Windows.Forms.Button #create the button
$ButtonExec.Location = New-Object System.Drawing.Size(10,10) #location of the button (px) in relation to the primary window's edges (length, height)  
$ButtonExec.Size = New-Object System.Drawing.Size(100,23) #the size in px of the button (length, height)
$ButtonExec.Text = "Execute" #labeling the button  
$ButtonExec.Cursor = [System.Windows.Forms.Cursors]::Hand
$ButtonExec.BackColor = [System.Drawing.Color]::White
$ButtonExec.Font = New-Object System.Drawing.Font ("Verdana",10, [System.Drawing.FontStyle]::Regular)  
$ButtonExec.Add_Click({}) #the action triggered by the button
$Form.Controls.Add($ButtonExec) #activating the button inside the primary window
$ButtonExec.Add_Click({PsExec})

#Exit Button
$ExitButton = New-Object System.Windows.Forms.Button #create the button
$ExitButton.Location = New-Object System.Drawing.Size(690,345) #location of the button (px) in relation to the primary window's edges (length, height)  
$ExitButton.Size = New-Object System.Drawing.Size(100,23) #the size in px of the button (length, height)
$ExitButton.Text = "Exit" #labeling the button  
$ExitButton.Add_Click({}) #the action triggered by the button
$Form.Controls.Add($ExitButton) #activating the button inside the primary window
$ExitButton.Add_Click({$Form.Close()})

###################################################################################################################################################
# - END BUTTONS -                                                                                                                                 #
###################################################################################################################################################


###################################################################################################################################################
# - LABELS -                                                                                                                                      #
###################################################################################################################################################

$Form.Controls.Add($Labelwks)
$Form.Controls.Add($LabelProg)

###################################################################################################################################################
# - ACTIVATE FORM -                                                                                                                                #
###################################################################################################################################################

[void] $Form.ShowDialog()
[void] $Form.Add_Shown({$Form.Activate()})
Mitglied: ITvortex
ITvortex 17.09.2014 aktualisiert um 12:51:08 Uhr
Goto Top
Wenn du den Fehlerbericht sendest dann musst du aber auch ein "mkdir C:\bin" machen und das natürlich auch dementsprechend abfangen (falls der Ordner schon vorhanden sein sollte).

Wenn der Ordner C:\bin nicht existiert bekommst du eine Exception und es startet dir kein Programm....

Gruß

PS:

$dirpath = "C:\bin"  

if( -not (Test-Path $dirpath) ) 
{
New-Item $dirpath -type directory
}
Mitglied: skahle85
skahle85 17.09.2014 um 12:51:43 Uhr
Goto Top
Na denn rein damit

###################################################################################################################################################
# - BEGIN FUNKTIONS -                                                                                                                             #
###################################################################################################################################################
#####################
# - FUNCTION PSEXEC - #
#####################
function PsExec {

$Prog=$InputBoxProg.text;
$wks=$InputBoxWKS.text; #takes the text from the input box into the variable $wks
$ProgResult=PsExec.exe -i -d /acceptEula \\$wks "$Prog" 2>c:\bin2\psexec.error.txt | fl | out-string -ErrorAction Stop;  
#$GetContent=c:\bin\psexec.error.txt;
if ((Test-Path -path C:\bin\) -ne $True)
{
New-Item C:\bin\ -type directory
}
$outputBox.text=Get-Content c:\bin2\psexec.error.txt #send the ping results to the output box


}
Mitglied: ITvortex
ITvortex 17.09.2014 um 12:54:17 Uhr
Goto Top
Zitat von @skahle85:

Na denn rein damit

> ###################################################################################################################################################
> # - BEGIN FUNKTIONS -                                                                                                             
>                #
> ###################################################################################################################################################
> #####################
> # - FUNCTION PSEXEC - #
> #####################
> function PsExec {
> 
> $Prog=$InputBoxProg.text;
> $wks=$InputBoxWKS.text; #takes the text from the input box into the variable $wks
> $ProgResult=PsExec.exe -i -d /acceptEula \\$wks "$Prog" 2>c:\bin2\psexec.error.txt | fl | out-string -ErrorAction  
> Stop;
> #$GetContent=c:\bin\psexec.error.txt;
> $dirpath = "C:\bin"  
> if( -not (Test-Path $dirpath) ) 
> {
> New-Item $dirpath -type directory
> }
> $outputBox.text=Get-Content c:\bin2\psexec.error.txt #send the ping results to the output box
> 
> 
> }
> 


gefällt mir besser ;)
Mitglied: skahle85
skahle85 17.09.2014 um 13:00:25 Uhr
Goto Top
Na Gut face-smile
Mitglied: ITvortex
ITvortex 17.09.2014 aktualisiert um 13:12:11 Uhr
Goto Top
face-smile

Jetzt müsste der Fragesteller mal testen ob es bei ihm klappt face-wink

Das ganze noch in eine .ps1 Datei und fertig.

http://www.mediafire.com/view/lkusg0ym2daxdbm/progStart.ps1

Hier das Script zum Download ;)


PS: Habe #BEGIN FUNKTIONS auf #BEGIN FUNCTIONS geändert
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 13:34:37 Uhr
Goto Top
Vielen vielen vielen Dank, ich probiere das am Freitag mal =)
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 14:09:41 Uhr
Goto Top
ich verstehe nur nicht was es mit dem großen Textfeld auf sich hat :/

wir haben ja den server.. muss ich dann eingeben \\tts02\user ? weil
wenn ich ganz normal einen user eingebe passiert nix :o
Mitglied: skahle85
skahle85 17.09.2014 aktualisiert um 14:19:48 Uhr
Goto Top
Das große "Textfeld" ist ein "Ausgabefeld" und verrät dir ob es 1. geklappt hat und wenn ja 2. mit welcher Prozess ID es gestartet wurde.

Edit: hätte ich noch beschriften sollen
Mitglied: Questionmark93
Questionmark93 17.09.2014 um 14:32:31 Uhr
Goto Top
ja hab es bemerkt :D danke vielmals =)
Mitglied: skahle85
skahle85 17.09.2014 um 14:35:14 Uhr
Goto Top
bau gerade noch eine dropdown liste für die workstations.
Mitglied: ITvortex
ITvortex 17.09.2014 um 15:01:26 Uhr
Goto Top
Du benötigst: RemoteZugriff, solltest evt auch die Datei Freigeben... Funktioniert bei mir über den Server Problemlos, allerdings greife ich in meinem Fall auf eine Freigabe zu....
Mitglied: skahle85
skahle85 17.09.2014 um 15:04:22 Uhr
Goto Top
so, folgendes ist jetzt anders:
du brauchst noch eine wks.txt und eine progs.txt
In meinem Fall liegen diese in "c:\bin\". Du kannst aber auch jeden anderen Pfad nutzen wenn du möchtest, musst ihn nur im code ändern siehe Beispiel:
#Dropdownlist Workstations
$DropDownWKS = New-Object System.Windows.Forms.ComboBox #creating the dropdown list
$DropDownWKS.Location = New-Object System.Drawing.Size(10,60) #location of the drop down (px) in relation to the primary window's edges (length, height)  
$DropDownWKS.Size = New-Object System.Drawing.Size(150,20) #the size in px of the drop down box (length, height)
$DropDownWKS.DropDownHeight = 200 #the height of the pop out selection box
$Form.Controls.Add($DropDownWKS) #activating the drop box inside the primary window

--> $wksList=@(Get-Content "c:\bin\wks.txt") <--  

foreach ($wks in $wksList) {
                      $DropDownWKS.Items.Add($wks)
                              } #end foreach

#Dropdownlist Programs
$DropDownProg = New-Object System.Windows.Forms.ComboBox #creating the dropdown list
$DropDownProg.Location = New-Object System.Drawing.Size(180,60) #location of the drop down (px) in relation to the primary window's edges (length, height)  
$DropDownProg.Size = New-Object System.Drawing.Size(150,20) #the size in px of the drop down box (length, height)
$DropDownProg.DropDownHeight = 200 #the height of the pop out selection box
$Form.Controls.Add($DropDownProg) #activating the drop box inside the primary window

--> $progList=@(Get-Content "c:\bin\progs.txt") <--  

foreach ($progs in $progList) {
                      $DropDownProg.Items.Add($progs)
                              } #end foreach

und hier jetzt das fertige Script:

http://www.mediafire.com/view/j4qvhb56z15dudb/PsExec.ps1
Mitglied: skahle85
skahle85 17.09.2014 um 15:08:58 Uhr
Goto Top
Zitat von @ITvortex:

Du benötigst: RemoteZugriff, solltest evt auch die Datei Freigeben... Funktioniert bei mir über den Server Problemlos,
allerdings greife ich in meinem Fall auf eine Freigabe zu....

Wo jetzt Wie?
Mitglied: ITvortex
ITvortex 17.09.2014 um 15:49:14 Uhr
Goto Top
Sorry das war etwas "undeutsch" face-smile

Hab gerade eine Frage in einem anderen Forum beantwortet sry :d

Ich meinte er solle es doch mal über eine Freigabe versuchen.

Und folgende Syntax verwenden:

Workstation:Dein-PC (kein \\)
Pfad:C:\ (-....wie gehabt)
Mitglied: ITvortex
ITvortex 17.09.2014 um 15:55:57 Uhr
Goto Top
Btw.: bei deinem Script bekomme ich bei Zeile 47 eine Nullpointer Exception -> Du versuchst eine nicht initialisierte Variable mit ToString() ?

lg
Mitglied: skahle85
skahle85 17.09.2014 aktualisiert um 16:02:03 Uhr
Goto Top
ach das ist mal wieder die Sache mit dem IF EXIST :D

ich frag jetzt nen textfile (wks.txt & progs.txt) ab. Beide unter c:\bin

$wks=$DropDownWKS.SelectedItem.ToString();

man kann auch noch zusätzlich diese Zeile darunter einfügen:

$wks=$DropDownWKS.Text;
damit manuelle Eingaben funktionieren ;)

Grüße
Mitglied: ITvortex
ITvortex 17.09.2014 um 16:03:42 Uhr
Goto Top
Ich weiß, es existieren in meinem Test Szenario auch beide ;)

In den DropDown menüs wird bei mir nur der Quellcode ausgegeben und keine "Elemente" angezeigt ;)
Mitglied: skahle85
skahle85 17.09.2014 um 16:11:08 Uhr
Goto Top
Sehr interessant...

http://www.mediafire.com/view/yfrcjfra89jc6f8/PsExec.ps1

hier noch mal das script...
Mitglied: ITvortex
ITvortex 17.09.2014 um 16:18:22 Uhr
Goto Top
Selbes Problem... ich habe immo keine Zeit um mir den Quellcode anzuschauen, aber kurz die Exceptions:

Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.
In C:\Users\Martin\Desktop\Peter Zellan Treiber\PsExec(1).ps1:47 Zeichen:1
+ $wks=$DropDownWKS.SelectedItem.ToString();
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) , RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.
In C:\Users\Martin\Desktop\Peter Zellan Treiber\PsExec(1).ps1:49 Zeichen:1
+ $Prog=$DropDownProg.SelectedItem.ToString();
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) , RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

und

CategoryInfo          : NotSpecified: (:String) , RemoteException     + FullyQualifiedErrorId : NativeCommandError   PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com  

Ich schau mir später den Quellcode an
Mitglied: skahle85
skahle85 17.09.2014 um 16:26:25 Uhr
Goto Top
Muss leider auch los :/
schreiben uns späta.

Gruß
Mitglied: skahle85
skahle85 18.09.2014 um 09:06:47 Uhr
Goto Top
Also den Fehler bekomme ich tatsächlich nur, wenn ich keine Angabe für Client und/oder Programm mache.
Mitglied: ITvortex
ITvortex 18.09.2014 um 09:39:15 Uhr
Goto Top
Sorry kam noch nicht dazu.... ich hab gerade noch zu tun ;)
Mitglied: ITvortex
ITvortex 18.09.2014 um 16:49:39 Uhr
Goto Top
Selber Fehler hmm... Poste doch mal deine 2 txt Dateien im Ordner C:\bin damit ich auch sicher auf dem selben Stand bin face-smile
Mitglied: skahle85
skahle85 19.09.2014 um 08:16:36 Uhr
Goto Top
Hi,
hier mal die Textdateien.
http://www.mediafire.com/view/1t78klxomrapsq1/wks.txt
http://www.mediafire.com/view/6xn29ad3luohykk/progs.txt

und hier noch mal das Script mit ein paar Anpassungen (eigentlich auf dem Stand den du auch hast nur mit Fehlerausgabe in der OutputBox)
http://www.mediafire.com/view/yfrcjfra89jc6f8/PsExec.ps1

PS: hast du dir die Zeile schon angeschaut?
#$wksList=@(Invoke-Command -ComputerName "mein DC" -ScriptBlock {Get-ADComputer -Filter * | select-object -expandproperty name}) 
Ganz nett eigentlich.
Mitglied: ITvortex
ITvortex 19.09.2014 um 09:44:17 Uhr
Goto Top
So.. hab mal alles aktualisiert ;)

Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.

Rest funktioneirt.

Jetzt schau ich mir mal den Sourcecode an ;)
Mitglied: Questionmark93
Questionmark93 19.09.2014 um 10:16:36 Uhr
Goto Top
Das scheint dann doch nicht so einfach zu sein wie anfangs gedacht :D
Mitglied: skahle85
skahle85 19.09.2014 um 10:20:08 Uhr
Goto Top
Eigentlich schon. Aber wenn dann 2 aufeinander treffen kanns schonmal vorkommen, dass es irgendwie größer wird als vorher erwartet :D.

Läuft es denn bei dir? Aktuellste Version ist 3 Posts weiter oben ;)
Mitglied: Questionmark93
Questionmark93 19.09.2014 um 10:28:07 Uhr
Goto Top
mh nein leider nicht, ich bekomme immernoch die Meldung

Sie können keine Methode für einen Ausdruck mit dem Wert NULL aufrufen.<
Mitglied: skahle85
skahle85 19.09.2014 um 10:32:48 Uhr
Goto Top
Gibst du bei "Workstation" nur die Workstation ein oder noch mit "\\"?

Die Backslashes brauchst du nämlich nicht mehr
Mitglied: skahle85
skahle85 19.09.2014 um 10:36:02 Uhr
Goto Top
Ok Ich habs!

Er mag die manuelle Eingabe nicht. Wenn man ein System aus der Liste auswählt läuft es
Mitglied: ITvortex
ITvortex 19.09.2014 um 10:45:27 Uhr
Goto Top
Wollte ich gerade sagen...
Mitglied: skahle85
skahle85 19.09.2014 um 10:47:48 Uhr
Goto Top
DC Abfrage um die Clientliste zu füllen:

Wenn von deiner Powershell aus dann:
Invoke-Command -ComputerName "DEIN DC" -ScriptBlock {Get-ADComputer -Filter * | select-object -expandproperty name} | Out-File <PFAD zu deiner wks.txt>

Wenn aufm DC dann:

Get-ADComputer -Filter * | select-object -expandproperty name} | Out-File <PFAD zu deiner wks.txt>
Mitglied: ITvortex
ITvortex 19.09.2014 um 10:51:59 Uhr
Goto Top
Hat sich ganz schön entwickelt das "kleine Projekt" face-smile

Aber so ist das immer, man macht das und dieses und jenes... dann macht es Spaß und naja du weißt bescheid ;)
Mitglied: Questionmark93
Questionmark93 19.09.2014 um 10:57:55 Uhr
Goto Top
Jetzt bekomme ich:

PsExec.exe : Bei L:\Tausch\PsExec.ps1:69 Zeichen:23 + $ProgResult=PsExec.exe <<<< -i -d /acceptEula \\$wks "$Prog" 2>c:\bin\psexec .error.txt | fl | out-string -ErrorAction Continue; + CategoryInfo : NotSpecified: (:String) , RemoteException + FullyQualifiedErrorId : NativeCommandError PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Das Handle ist ung³ltig. Connecting to j.rybak...Couldn't access j.rybak: Connecting to j.rybak...
Mitglied: skahle85
skahle85 19.09.2014 um 11:04:04 Uhr
Goto Top
Versuchst du zu einem Benutzernamen zu connecten?
Connecting to j.rybak...
Mitglied: ITvortex
ITvortex 19.09.2014 um 11:06:08 Uhr
Goto Top
Was willst du den da anstellen?

Du musst schon den Computernamen angeben und nicht den Benutzer,.....
Mitglied: Questionmark93
Questionmark93 19.09.2014 um 11:14:59 Uhr
Goto Top
Ja weil wegen Server ? ^^
Mitglied: skahle85
skahle85 19.09.2014 um 11:21:27 Uhr
Goto Top
Was meinst du mit Server? Einen Server brauchst du nicht außer du möchtest bevor du das kleine Tool nutzt noch schnell sämtliche Clients in eine Datei exportieren - siehe Post weiter oben.

Ansonsten ist ja alles klar definiert. Workstation einfach aus der Liste Auswählen - Programm aus der Liste auswählen - Fertig

An welcher Stelle bist du denn gerade?
Mitglied: Questionmark93
Questionmark93 19.09.2014 um 11:25:48 Uhr
Goto Top
Ich verbinde mich ja mit dem Server und dann suche ich nach Updates von 'nem Programm.
Das Programm schließt ja dann sämtliche Prozesse und installiert die Updates.

Wenn das ganze fertig ist wollte ich gerne wieder an dem entsprechenden Arbeitsplatz
das Programm öffnen.
Mitglied: ITvortex
ITvortex 22.09.2014 um 09:12:25 Uhr
Goto Top
Tasksheduler ist hierfür das Stichwort.
Mitglied: Questionmark93
Questionmark93 22.09.2014 um 14:55:40 Uhr
Goto Top
hm sagt mir nichts =/
Mitglied: ITvortex
ITvortex 22.09.2014 um 15:45:23 Uhr
Goto Top
Mitglied: Questionmark93
Questionmark93 23.09.2014 um 08:23:07 Uhr
Goto Top
... oh man :DD

wie schreibt ihr eigendlich die skripte?
mit welchem programm?
Mitglied: ITvortex
ITvortex 23.09.2014 um 09:08:41 Uhr
Goto Top
Ja als ein bisschen eigeninitiative sollte schon gegeben sein.

Programm?

Für Windows Powershell - Windows Powershell ISE ?