I run powershell from my local machine using my login USERDOMAIN\myid
I want to change the password for the service accounts that reside in a
different domain PRODDOMAIN\svc_account1. I have permissions to change the
service account passwords, and I am able to change the password using the
windows server tool "Active Directory Users and Computers" . I cannot get
the password change to work using Powershell.
I want to avoid having to install the quest cmdlets.
I have searched quite a while and this code snippet seems close to what I
need.
$password='NewPWValue1'
$user = [ADSI]"LDAP://CN=svc_account1,OU=Service Accounts,OU=User
Data,DC=proddomain,DC=mycompany,DC=com"
$user.Invoke("SetPassword", $password)
$user.pwdLastSet = 0
$user.SetInfo()
I get this errormessage when I run that code:
Exception calling "Invoke" with "2" argument(s): "Member not found.
(Exception from HRESULT: 0x80020003 (DISP_E_MEMBERN
OTFOUND))"
At line:1 char:13
+ $user.Invoke( <<<< "SetPassword", "NewPassword123")
If I do end up using the ADSI, is there a way to translate t he PRODDOMAIN
to the FQDN as in PRODDOMAIN.mycompany.com
If you have a better script that works that would be fine.
Please help if you can.
PS C:\Users\webstonne\Utilities\Launch> set-executionpolicy
Set-ExecutionPolicy : Access to the registry key
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShel
l' is denied.
At line:1 char:20
+ set-executionpolicy <<<<
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy],
UnauthorizedAccessException
+ FullyQualifiedErrorId :
System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
--
Charlie.
http://msmvps.com/blogs/xperts64
http://mvp.support.microsoft.com/profile/charlie.russel
"J. Perry Stonne" <black...@charter.net> wrote in message
news:%23YpdvQg...@TK2MSFTNGP06.phx.gbl...
"Charlie Russel - MVP" <cha...@mvKILLALLSPAMMERSps.org> wrote in message
news:e641oTg4...@TK2MSFTNGP03.phx.gbl...