I'm really stuck trying to change the StartName and StartPassword for the Spool service using the Change method of the Win32_Service class in PowerShell. The StartService and StopService methods work fine, but with Change, I'm receiving errors: 22 for a bogus user and 21 for a valid domain user. I've tried running the commands in an elevated PowerShell session on my local machine but can't seem to get it right, even though I'm using the same commands from earlier chapters that worked. Here's what I've tried: 1) Using splatting with Invoke-CimMethod and 2) A simplified one-liner, but both yield a return value of 21. I also noticed some syntax differences between what I'm doing and what the book suggests, like the use of semicolons and the equal sign instead of 'like'. I'm not sure why this isn't working. Any ideas?
1 Answer
It looks like you might be having issues with the spooler service specifically. I'd recommend trying to change the settings for a different service just to see if that works. Also, just for troubleshooting, you might want to remove the -ComputerName parameter altogether. It can complicate things, especially with the spool service.
Removing it might help clear out any unexpected behavior caused by remote command logic.

That's actually interesting! The @ symbol likely got turned into something like `u/`. I think the platform is automatically converting it.