I want to make a script that will remove domain user account from remote computer. Right now I tested dosen of methods. I have stick to this:
([ADSI]"WinNT://$computerName/$localGroupName,group").Remove("WinNT://$domainName/$userName")
Thats absolutely working on local computer, but when I try to reach the remote computer I get 'Access Denied' error.
I do know the credentials for remote computer. I know how to created credential object. Now I am stuck with - how to force it use credential object with that kind of task?
Invoke is not an option.