Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Changing password for a local user on a remote computer....

Reply
 
Old 06-09-2009   #1 (permalink)
A. Mikkelsen


 
 

Changing password for a local user on a remote computer....

Hi,

I've been looking for an PS script to change the password for a local user
on a remote server.

For WIN 2003 servers this works:
$admin=[adsi]("WinNT://" + $strIP + "/" + $strUser + ", user")
$admin.psbase.invoke("SetPassword", $strPWD)

But when I run the script against a Win 2008 server I get the exception:
Exception calling "Invoke" with "2" argument(s): "Exception has been thrown
by the target of an invocation."
At :line:40 char:22
+ $admin.psbase.invoke <<<< ("SetPassword", $strPWD)

Does anyone know how to fix the error or set the password for a local user -
remotely???

Really need help - have over 300 servers that need password changes.....

\\A. Mikkelsen

My System SpecsSystem Spec
Old 06-09-2009   #2 (permalink)
Jakob Svendsen


 
 

Re: Changing password for a local user on a remote computer....

Hello A. Mikkelsen (anders? ;-))

I have tested your issue
and i found out that if i put a password that does not meet the password
requirements, i get the same error as you.

(was testing on a win2008 R2, but it should be the same ?).

but if the password is acceptable, i have no errors with your code
if you run it on a local powershell on the win2008 i get a more detailed
error message.


I hopt it helps!

Best Regards

Jakob Svendsen

http://blog.coretech.dk/athors/jgs




"A. Mikkelsen" <A. Mikkelsen@xxxxxx> wrote in message
news:62341417-C645-4E94-88A6-CFE5210F1CD8@xxxxxx
Quote:

> Hi,
>
> I've been looking for an PS script to change the password for a local user
> on a remote server.
>
> For WIN 2003 servers this works:
> $admin=[adsi]("WinNT://" + $strIP + "/" + $strUser + ", user")
> $admin.psbase.invoke("SetPassword", $strPWD)
>
> But when I run the script against a Win 2008 server I get the exception:
> Exception calling "Invoke" with "2" argument(s): "Exception has been
> thrown
> by the target of an invocation."
> At :line:40 char:22
> + $admin.psbase.invoke <<<< ("SetPassword", $strPWD)
>
> Does anyone know how to fix the error or set the password for a local
> user -
> remotely???
>
> Really need help - have over 300 servers that need password changes.....
>
> \\A. Mikkelsen
My System SpecsSystem Spec
Old 06-09-2009   #3 (permalink)
Jakob Svendsen


 
 

Re: Changing password for a local user on a remote computer....

Hello A. Mikkelsen (anders? ;-))

I have tested your issue
and i found out that if i put a password that does not meet the password
requirements, i get the same error as you.

(was testing on a win2008 R2, but it should be the same ?).

but if the password is acceptable, i have no errors with your code
if you run it on a local powershell on the win2008 i get a more detailed
error message, describing the password complexity error.


I hope it helps!

Best Regards

Jakob Svendsen

http://blog.coretech.dk/athors/jgs




"A. Mikkelsen" <A. Mikkelsen@xxxxxx> wrote in message
news:62341417-C645-4E94-88A6-CFE5210F1CD8@xxxxxx
Quote:

> Hi,
>
> I've been looking for an PS script to change the password for a local user
> on a remote server.
>
> For WIN 2003 servers this works:
> $admin=[adsi]("WinNT://" + $strIP + "/" + $strUser + ", user")
> $admin.psbase.invoke("SetPassword", $strPWD)
>
> But when I run the script against a Win 2008 server I get the exception:
> Exception calling "Invoke" with "2" argument(s): "Exception has been
> thrown
> by the target of an invocation."
> At :line:40 char:22
> + $admin.psbase.invoke <<<< ("SetPassword", $strPWD)
>
> Does anyone know how to fix the error or set the password for a local
> user -
> remotely???
>
> Really need help - have over 300 servers that need password changes.....
>
> \\A. Mikkelsen
My System SpecsSystem Spec
Old 06-10-2009   #4 (permalink)
A. Mikkelsen


 
 

Re: Changing password for a local user on a remote computer....

HeY Jakob

Yes - Anders Here :-)

I just tested and it works when I:
- log in as administrator and change the password for a local user
- log in as a user that is member of the local administrator group, open
powershell as administrator, then I can change the password for the user and
the administrator.

But it doesn't work when I:
- log in as a user that is member of the local administrator group and try
to change the password for the local administrator or the user it self.

Seems that beeing member of the administrator group isn't the same as being
administrator.

Does anyone know how to run PS as Administrator on a remote system when you
connect with a user that is only member of the administrator group?

\\A. Mikkelsen

"Jakob Svendsen" wrote:
Quote:

> Hello A. Mikkelsen (anders? ;-))
>
> I have tested your issue
> and i found out that if i put a password that does not meet the password
> requirements, i get the same error as you.
>
> (was testing on a win2008 R2, but it should be the same ?).
>
> but if the password is acceptable, i have no errors with your code
> if you run it on a local powershell on the win2008 i get a more detailed
> error message, describing the password complexity error.
>
>
> I hope it helps!
>
> Best Regards
>
> Jakob Svendsen
>
> http://blog.coretech.dk/athors/jgs
>
>
>
>
> "A. Mikkelsen" <A. Mikkelsen@xxxxxx> wrote in message
> news:62341417-C645-4E94-88A6-CFE5210F1CD8@xxxxxx
Quote:

> > Hi,
> >
> > I've been looking for an PS script to change the password for a local user
> > on a remote server.
> >
> > For WIN 2003 servers this works:
> > $admin=[adsi]("WinNT://" + $strIP + "/" + $strUser + ", user")
> > $admin.psbase.invoke("SetPassword", $strPWD)
> >
> > But when I run the script against a Win 2008 server I get the exception:
> > Exception calling "Invoke" with "2" argument(s): "Exception has been
> > thrown
> > by the target of an invocation."
> > At :line:40 char:22
> > + $admin.psbase.invoke <<<< ("SetPassword", $strPWD)
> >
> > Does anyone know how to fix the error or set the password for a local
> > user -
> > remotely???
> >
> > Really need help - have over 300 servers that need password changes.....
> >
> > \\A. Mikkelsen
>
>
My System SpecsSystem Spec
Old 06-10-2009   #5 (permalink)
A. Mikkelsen


 
 

Re: Changing password for a local user on a remote computer....

HeY Jakob

Yes - Anders Here :-)

I just tested and it works when I:
- log in as administrator and change the password for a local user
- log in as a user that is member of the local administrator group, open
powershell as administrator, then I can change the password for the user and
the administrator.

But it doesn't work when I:
- log in as a user that is member of the local administrator group and try
to change the password for the local administrator or the user it self.

Seems that beeing member of the administrator group isn't the same as being
administrator.

Does anyone know how to run PS as Administrator on a remote system when you
connect with a user that is only member of the administrator group?

\\A. Mikkelsen

"Jakob Svendsen" wrote:
Quote:

> Hello A. Mikkelsen (anders? ;-))
>
> I have tested your issue
> and i found out that if i put a password that does not meet the password
> requirements, i get the same error as you.
>
> (was testing on a win2008 R2, but it should be the same ?).
>
> but if the password is acceptable, i have no errors with your code
> if you run it on a local powershell on the win2008 i get a more detailed
> error message, describing the password complexity error.
>
>
> I hope it helps!
>
> Best Regards
>
> Jakob Svendsen
>
> http://blog.coretech.dk/athors/jgs
>
>
>
>
> "A. Mikkelsen" <A. Mikkelsen@xxxxxx> wrote in message
> news:62341417-C645-4E94-88A6-CFE5210F1CD8@xxxxxx
Quote:

> > Hi,
> >
> > I've been looking for an PS script to change the password for a local user
> > on a remote server.
> >
> > For WIN 2003 servers this works:
> > $admin=[adsi]("WinNT://" + $strIP + "/" + $strUser + ", user")
> > $admin.psbase.invoke("SetPassword", $strPWD)
> >
> > But when I run the script against a Win 2008 server I get the exception:
> > Exception calling "Invoke" with "2" argument(s): "Exception has been
> > thrown
> > by the target of an invocation."
> > At :line:40 char:22
> > + $admin.psbase.invoke <<<< ("SetPassword", $strPWD)
> >
> > Does anyone know how to fix the error or set the password for a local
> > user -
> > remotely???
> >
> > Really need help - have over 300 servers that need password changes.....
> >
> > \\A. Mikkelsen
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Changing the local admin password base on the computer's OU VB Script
renaming Local user account and Changing "Full Name" of same Local VB Script
change user password on remote computer VB Script
Re: changing password for a existing ad user PowerShell
changing password for a existing ad user PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46