I'm trying to get a simple Powershell script to run as a GPO startup script on my school workstations. So far I have not had much luck. The script started as a more complex set of commands to determine if an application was installed or not, and what version, and then install an updated version if necessary. None of that worked, so I reduced the script to just two lines to see if the script even runs. It does not seem to be.
The current code:
set-content -Path c: PSTests PSTest.log -value "The PSTest script ran successfully"
This has been installed in a GPO in
Computer Configuration / Windows Configuration / Scripts (Start / Shutdown) / Start
I can run this in the Powershell ISE if I log in, and the text file is created or updated, but using it as a GPO startup script has no discernible effect.
gpresult / h To determine if the policy is being applied (s):
I have also checked the system logs in
Application and service logs / Microsoft / Windows / GroupPolicy / Operationalwhich reports a list of applicable group policy objects that my GPO script includes. It also reports the start of Scripts Extension processing and lists my GPO, and completes the processing, but does not report errors between these two points.
Then, it seems that my policy object is being applied, and that my workstation is making some attempt to process it. However, the file that you are supposed to create never appears.
Clearly I'm missing something, but what?