I am trying to set up a GCP server running Windows Server 2025 Core Edition to remote debug a Visual Studio File. A required step for this is to run the command “msvsmon.exe” with arguments “/silent /nostatus”
The intent is to automate this command at the time of the server startup. It runs perfectly fine if invoked manually after the startup.
The command I am struggling with :
$action= New-ScheduledTaskAction -Execute "msvsmon.exe" -Argument "/silent /nostatus" -WorkingDirectory "C:\Program Files\Microsoft Visual Studio 17.0\Common7\IDE\Remote Debugger\x64"
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId "gcpuser" # (also have tried <server_name>\gcpuser - no luck) (this user is a non-admin user)
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask -Taskname "vsdeb" -InputObject $task -TaskPath "C:\Program Files\Microsoft Visual Studio 17.0\Common7\IDE\Remote Debugger\x64\"
Have tried quite a few variations but no luck.
The error reported by Register-ScheduledTask : the parameter is incorrect. HRESULT 0x80070057
The execution of these commands is done using an administrator login though the actual user (“gcpuser”) is an non-admin user. The corresponding manual version requires logging in (remotely) using an Enter-psssession with “gcpuser” credentials, and then doing a cd to the working directory and then executing a .\msvsmon.exe /silent /nostatus.
The powershell version is 5.1.20348.2849, though have tried on powershell 7.5.2 as well
All advice is welcome.
Thanks…