question

SP-4916 avatar image
1 Vote"
SP-4916 asked DSPatrick answered

Startup script Not executed on Windows Server

Newbie here. Using Windows Server 2019, I copied over my bat file to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" and did a restart. my bat file is supposed to ping another machine. However, the startup scripts are not executed unless I login into the machine.

However, if I add the same file to "GPO -> Computer Configuration" and restart, it is working fine. Is this the only way to do this without anyone logging in? If so, is there any powershell script to do it.

Thanks a Ton

windows-serverwindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
1 Vote"
DSPatrick answered SP-4916 commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Any powershell script to add the script to GPO?

1 Vote 1 ·
DSPatrick avatar image
1 Vote"
DSPatrick answered

Give this one a go,
https://superuser.com/questions/1325592/programmatically-create-machine-startup-script-in-local-group-policy-script-exe


--please don't forget to Accept as answer if the reply is helpful--




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.