cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MGSPolicy Batch file

Hi - I'm new to using Flexera and I've been tasked with creating a batch/cmd file to run MGSPolicy.exe -t Machine.    It runs but I get no message whether it completes successfully.    Is there any way on the client machine to know if it ran successfully?    I currently do not have access to the server.   Looking for any help as I always like to make sure scripts run completely and successfully.

0 Kudos
1 Reply
ChrisG
Community Manager Community Manager
Community Manager

One approach would be to check the exit status of the mgspolicy process. For example:

start /wait mgspolicy -t Machine
if %ERRORLEVEL% neq 0 echo Policy updated failed

You could also look at the end of the <TempDirectory>\ManageSoft\policy.log file, which will show an indication of whether the process succeeded or failed. It if succeeded:

[04/21/2022 3:25:37 PM (G, 0)] {784} Program exited successfully

If it failed, a non-0 code will be noted:

[10/22/2022 12:22:32 PM (G, 0)] {11896} Program exited with code 1

 

(Did my reply solve the question? Click "ACCEPT AS SOLUTION" to help others find answers faster. Liked something? Click "KUDO". Anything expressed here is my own view and not necessarily that of my employer, Flexera.)