If a password contains special characters such as ', ", ^ etc. (any character that would render a global WMI switch invalid) it should be escaped to prevent parsing errors.
The escaping strategy will be dependent on the shell / environment in which commands are executed - the solution needs to be versatile enough to account for these dependencies.
This is a bit of a challenge because having combinations of these characters is possible, although that is probably best considered an edge case.