windows - Scheduled Powershell Task, stuck Running -
I have problems while running PowerShell script in the scheduled task. I get stuck in running it, even if transcript has the last line "don ! " And it looks like I want to do this. What am I missing?
It looks fine when running from If necessary please see the code below. # $ PowerShell Reprint Copy first folder, Last Modified Function Timestamp {$ ts = Get-date-return of format $ ts} $ from directory = "D: \ _ temp \ copy_bat" $ ToDirectory = "D: \ _ temp \ in_dummy" $ extractGUIDdir = "" $ docTypeDir = "# # logging ######### Error operation_princess =" quiet content "stop-transcript | out- null $ ErrorActionPreference = "Continue" Start-transcript - $ directory from $ copy_one_reprint_folder.log.txt -append ########## Type- Host "Write-Host" (Timestamp) "Remove Copy Copy Start "Write-Host (Timestamp)" ============== . PSIsContainer} | Sort Object Creation Time | `Object {$ _.} Name-a" _copied "} | selection-object-first1 | 'pre-object (list-hostname) $ _ .name $ extractGUIDdir = $ _ Get the full name go- childitem-path $ extractGUIDdir | | {$ _. PSIsContainer} | where-object {$ _.} Name -mail "purchase order (9999 99 7) \" - or $ _name- match "logistics Document \ (- 1000000000 \) "-or $ _ Name-matching "Specifications (-999999998 \)"} | These folders (document types) were also found, but it will not be included in "Get-ChildItem", "Get-ChildItem", "Get-ChildItem", "Fast-Object" (Type-Host (Timestamp) "$ _. Name} Write-Host" -path $ extract objectdir - Include "Logistics Document (-1000000000)", "Purchase Order (9999 99 99)", "Specifications (-999999 99 8)" -? | {$ _. PSIsContainer} | "Pre-Object (Timestamp)" - "$ _. Name} Write-Host" "Go -Balitim-Path $ extractGUIDdir | | {$ _. PSIsContainer} | Where-Object {$ _.} - "Purchase order (9999 99 99)" or "$ _name-match" logistics document (- 1000000000 \) "or $ _. Name-matching" specification \ (-999999998 \) "}. "Foreach-Object {$ Temp_name" $ _England Name-Host (Timestamp) "" Copy $ "from $$" Copywriter ($ _FullName) \ "Fully Name-Host" (Timestamp) "$ _Config files" * * Directory list-host (timestamp) from $ "copy meta-file ..." copy-item $ temp_name * * Meta $ from directory-filter * .meta write-host (timestamp) "Copy pdf-files ..." copy-items $ temp_name * *. Pdf $ toDirectory -Filter * .pdf if (test-path $ temp_name *. * -Exclude * .meta, * .pdf) {Write-host (timestamp) "Warning / Error Not all documents have been transferred only PDF has been moved! "Write-host (timestamp)" Check the folder for other document types. " }} Move-item $ extractGUIDdir $ to directory \ _copied} Write-host (timestamp) "Done!" # Stop logging stop-transcript This is resolved. This works, stupid I did not press Actually I was doing a lot, but I did not do it apparently. run in Windows:
powershell -file "D: \ _ temp \ copy_bat \ copy_one_reprint_folder.ps1" <
powershell.exe
-file "D: \ _ temp \ copy_bat \ copy_one_reprint_folder.ps1"
F5 (Update) in the task scheduler to update the status of work in Gui.
Comments
Post a Comment