What exactly is the error\issue? First thing that jumps out is you are writing to the root of C:, which standard users don’t have permissions to do. A better default path would be something like this:
So if they put in a service that isn’t recognized it’ll warn them and log it into a file. I have everything work besides the log being sent to a file.
There is code in the function to accomplish what you are asking. Are you getting an error? Are you adding the switch -LogErrors to the command?
I got it to work thanks!