131455

Frage zu einem Task im Task Scheduler File manuell ausgeführt, dann erstellt es ein Excel auf Laufwerkspfad Mit Batchjob nicht

Hallo,

ich habe ein *.ps1 File. Wenn ich das manuell starte . Inhalt :

get-aduser -filter * -SearchBase "OU=Niederlassung,DC=contoso,DC=local" -properties * | select-object Name,GivenName,Surname,Description,TiTle,personaltitle,EmployeeNumber,Department,Officephone,mobile |  
export-csv "\\contoso\contoso_web$\dokus\verzeichnis AD User\ADUser.csv" -notypeinformation -delimiter ";" -encoding utf8  

Schreibt es mir schön alle Mitarbeiter in ein CSV , auf diesen Pfad.

Nun habe ich das per Aufgabenplaner hinterlegt. Es ist ein Batchuser definiert. Der aber auch Modify Rechte auf den Pfad \\contoso\contoso_web$\dokus\verzeichnis AD User hat.
Nun startet der Batch Job Montags 8 Uhr. "Run with Highest Privileges"

Actions: Start a Programm

Program/script : powershell.exe
Dann mit Add Arguments : -ExecutionPolicy Bypass -File "C:\Support\script\Alle_ADUser.ps1"

Aber auf den Pfad , schreibt es das leider nicht .

jemand ne Idee ?

Gruss
Rainer
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 358314

Url: https://administrator.de/forum/frage-zu-einem-task-im-task-scheduler-file-manuell-ausgefuehrt-dann-erstellt-es-ein-excel-auf-laufwerkspfad-358314.html

Ausgedruckt am: 04.05.2025 um 10:05 Uhr

134998
Lösung 134998 15.12.2017 aktualisiert um 11:36:11 Uhr
Goto Top
Put
Start-Transcript "C:\log.txt"  
   # your code
Stop-Transcript
around your script, and you will see all errors in your logfile.

Es ist ein Batchuser definiert.
This Batch-User really has the "run as batch job" privileges on this server, and additionally usage rights for the Module "ActiveDirectory"?

Best regards
Tom
131455
131455 15.12.2017 aktualisiert um 11:52:55 Uhr
Goto Top
Hallo,

the User have Modify rights on that Path. But it is coming

PS>TerminatingError(Export-Csv): "Access to the path '\contoso\contoso_web$\dokus\verzeichnis AD User\ADUser.csv is denied."
export-csv : Access to the path '\contoso\contoso_web$\dokus\verzeichnis AD User\ADUser.csv' is
denied.

I set Folder to "Everyone Full" . Still + CategoryInfo : OpenError: (face-smile [Export-Csv], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand


Greets
Ralf
131455
131455 15.12.2017 um 12:24:32 Uhr
Goto Top
it was the share Right.

Greets
Rainer