I have a PowerShell script that logs certain information to a file via the Out-File command:
"text to be logged" | Out-File $logFile -Append
When the PowerShell script is run directly, the log file is created/updated without any problems. This PowerShell script is called through a batch script (due to a tool I am utilizing that only accepts batch scripts as input) through the following command:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File """"%powerShellScriptPath%"""" """"%argOne%"""" """"%argTwo%""""' -Verb RunAs}";
The command I am implementing above is based on the implementation found in this answer.
When called through the batch script, the log file never gets created/updated. The PowerShell script performs all of its duties behind the scenes without issues, it simply fails to create the log file or populate it with data...