Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I change domain account password

31 views
Skip to first unread message

DBAdan

unread,
May 31, 2009, 12:04:01 AM5/31/09
to
I have service accounts that I use to run SQL Server services.

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.

J. Perry Stonne

unread,
May 31, 2009, 11:26:31 AM5/31/09
to
Why do I get this error message when I try to change execution policy?

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 Russel - MVP

unread,
May 31, 2009, 11:31:44 AM5/31/09
to
You need to run PowerShell "As Administrator" to change the execution
policy. Right click on the PowerShell icon and select "Run As
Administrator".

--
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...

J. Perry Stonne

unread,
May 31, 2009, 4:19:26 PM5/31/09
to
The life of a newbie is a life of uncertainty. Slowly but surely, the
opperation is making sense. Reading PowerShell in Action by Bruce Payette
.It all seems simple once the light goes on ... scripts are running and I
can change the setting back to industrial strength if I ever buy a Class III
signature.

"Charlie Russel - MVP" <cha...@mvKILLALLSPAMMERSps.org> wrote in message
news:e641oTg4...@TK2MSFTNGP03.phx.gbl...

0 new messages