keiosid
Goto Top

Einen Link Powershell ausführen

Hallo,
bisher hatte ich nichts mit Powerhell zu tun, hatte das eigentlich auch nicht vor.

Nun erwartet man aber von mir, dass ich einen bestimmten Link(lokal) mit Powershell aufrufe.
Mit Batch habe ich das hinbekommen, aber dann öffnet sich nur der IE, und das war es dann.

Ist das ähnlich zu realisieren wie mit Batch, oder muss ich hier erst eine Art Runtime installieren?
Und wie sieht die Syntax aus.
Das ganze soll dann per Scheduled Task ausgeführt werden.


System: Win Server 2008 R2 Standard.

Danke im voraus.

Grüße Keios

Content-Key: 312066

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

Printed on: April 24, 2024 at 19:04 o'clock

Mitglied: 129813
129813 Aug 08, 2016 at 07:34:57 (UTC)
Goto Top
start-process "http://domain.com"  
Regards
Member: KeiosID
KeiosID Aug 08, 2016 at 08:01:40 (UTC)
Goto Top
hi highload,

wo trage ich dass dann ein?

Das ganze in einer*.bat funktioniert nicht wirklich.
@echo on
start process "http://localhost/AP3/AP3cron.php"  
pause
exit

da bekomme ich nur eine Fehlermeldung, dass der Prozess nicht gefunden werden kann.

Danke
Grüße
KeiosID
Member: TlBERlUS
TlBERlUS Aug 08, 2016 at 08:28:57 (UTC)
Goto Top
Zitat von @KeiosID:
wo trage ich dass dann ein?
In eine *.ps1-Datei?
Das ganze in einer*.bat funktioniert nicht wirklich.
Das ist dann ja auch kein Powershell.
Danke
Bitte

Tiberius
Member: Tungdal
Tungdal Aug 08, 2016 updated at 08:30:20 (UTC)
Goto Top
start-process ist ein Powershell-Befehl.
also müsstest du erst die Powershell aufrufen mit bsp:
powershell.exe "start-process https://administrator.de"  

Edit: Bzw komplett mit Powershell mit "*.ps1" statt "*.bat", stimmt
Mitglied: 129813
Solution 129813 Aug 08, 2016 updated at 09:09:40 (UTC)
Goto Top
Zitat von @KeiosID:
Das ganze in einer*.bat funktioniert nicht wirklich.
face-big-smile You asked for Powershell not Batch my friend !

In the scheduled task enter powershell.exe as command path. Then under arguments enter:
-Executionpolicy ByPass -windowstyle hidden -NoProfile -Command "start-process 'http://localhost/AP3/AP3cron.php'"
So you don't need any batch for this. This can be totally saved inside the scheduled task.

Inside a Batch you can call a powershell command or script like this:
powershell -Executionpolicy ByPass -windowstyle hidden -NoProfile -Command "start-process 'http://localhost/AP3/AP3cron.php'"

IMPORTANT: Be sure to start the scheduled task in the context of the user who is logged in otherwise no one will ever see the window of the website!!

Regards
Member: KeiosID
KeiosID Aug 08, 2016 at 10:17:20 (UTC)
Goto Top
Hallo,

dank an die Hilfe, die ersten Schritte funktionieren.
@129813
Thanks for the batch statement. I am really new on Powershell, and I think this made my current Problem solved.