131455
Goto Top

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

Content-Key: 358314

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

Printed on: April 23, 2024 at 21:04 o'clock

Mitglied: 134998
Solution 134998 Dec 15, 2017 updated at 10:36:11 (UTC)
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
Mitglied: 131455
131455 Dec 15, 2017 updated at 10:52:55 (UTC)
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
Mitglied: 131455
131455 Dec 15, 2017 at 11:24:32 (UTC)
Goto Top
it was the share Right.

Greets
Rainer