What kind of operation you are trying to perform using macro?
Are you running the cmd line script using task scheduler or Directly from cmd prompt?
Please check whether you have enabled below options
"Current Local Security Allow System Access" and "Requested Module Security - System Access"
Add msgbox("Alert") code in between your code to check whether the problem is with running the macro or some kind of code issue.