I am trying to login into a computer. I have been playing with various versions and determined that my past questions were when I didn\'t know what I was really trying to do.
WOW I figured it out thanks to https://social.technet.microsoft.com/forums/windowsserver/en-US/440ab7ed-7727-4ff7-a34a-6e69e2dff251/getwmiobject-prompting-for-password-issues
So I didn't realize I can use the $MySecureCreds
as the -credential
ANSWER:
$Username = 'domain\username'
$Password = 'password'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$SecureString = $pass
# Users you password securly
$MySecureCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username,$SecureString
gwmi win32_service –credential $MySecureCreds –computer PC#