Hi Isaias,
I had a similar situation. Using the power-shell script for MS Security Patches and subsequent restart and was getting the same "HTTP error, HTTP/1.1 401 Unauthorized" which was fixed by adding the service* parameters following Note 2010805 - SAP MMC common issues .
Since the script was calling the sapcontrol from one SAP system and taking care of all the other systems in the landscape I had to add the sidadm of the central system in the profile for all the other managed system.
The script is working fine ever since then. In case there is something which I need to re-check please do let me know.
Thanks,
Manas