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

net user administrator changeme

61 views
Skip to first unread message

IT STAFF

unread,
Jun 25, 2008, 11:49:45 PM6/25/08
to
Is it possible to use powershell to perform the above for remote machines. ?

Assume that i've a pclist.txt and i've admin permissions on remote machines.

Marco Shaw [MVP]

unread,
Jun 26, 2008, 7:53:12 AM6/26/08
to
IT STAFF wrote:
> Is it possible to use powershell to perform the above for remote machines. ?
>
> Assume that i've a pclist.txt and i've admin permissions on remote machines.
>
>
>

I'd use WinRM if you're looking to run a DOS-style command:

PS > get-content pclist.txt|foreach-object{winrs /r:$_ net user}

You may have to do something like this though:

PS > get-content pclist.txt|foreach-object{winrs /r:$_ /u:your_username
/p:your_password net user}

Assuming you have WinRM running everywhere... Do you? Otherwise,
perhaps WMI...

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com

Brandon [MVP]

unread,
Jun 26, 2008, 8:18:56 AM6/26/08
to
woah... smoking a little to much of the WinRM weed :)

foreach($Computer in (get-content PCList.txt)
{
$admin=[adsi]"WinNT://$Computer/administrator, user"
$admin.psbase.invoke("SetPassword", "ChangeME!")
$admin.psbase.CommitChanges()
}

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:eLIZVN41...@TK2MSFTNGP02.phx.gbl...

Marco Shaw [MVP]

unread,
Jun 26, 2008, 8:32:26 AM6/26/08
to
Brandon [MVP] wrote:
> woah... smoking a little to much of the WinRM weed :)
>
> foreach($Computer in (get-content PCList.txt)
> {
> $admin=[adsi]"WinNT://$Computer/administrator, user"
> $admin.psbase.invoke("SetPassword", "ChangeME!")
> $admin.psbase.CommitChanges()
> }

Does ADSI depend on RPC? Must try it someday.

Marco

Hal Rottenberg

unread,
Jun 26, 2008, 10:05:53 AM6/26/08
to
Marco Shaw [MVP] wrote:
> I'd use WinRM if you're looking to run a DOS-style command:
>
> PS > get-content pclist.txt|foreach-object{winrs /r:$_ net user}

Brandon [MVP] wrote:
> woah... smoking a little to much of the WinRM weed :)

Aside from Brandon (for whom we already know the answer :) ), I'm curious to
know who has deployed and is using WinRM in any capacity right now? I'm not
talking specifically about the PS V2 CTP remoting, because I know the Vista/2008
requirements push it beyond the applicability of many. In a more general sense,
have you played with it at all?

--
Author, Tech Prosaic blog (http://halr9000.com)
Webmaster, Psi (http://psi-im.org)
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast (http://powerscripting.net)

Brandon Shell [MVP]

unread,
Jun 26, 2008, 11:06:02 AM6/26/08
to
In this case it would... for AD stuff it should use LDAP.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

M> Brandon [MVP] wrote:
M>

>> woah... smoking a little to much of the WinRM weed :)
>>
>> foreach($Computer in (get-content PCList.txt)
>> {
>> $admin=[adsi]"WinNT://$Computer/administrator, user"
>> $admin.psbase.invoke("SetPassword", "ChangeME!")
>> $admin.psbase.CommitChanges()
>> }

M> Does ADSI depend on RPC? Must try it someday.
M>
M> Marco
M>


Brandon Shell [MVP]

unread,
Jun 26, 2008, 11:30:13 AM6/26/08
to
I have spoken to numerous consultants and none (small or large) knew of any
customers that use WinRM or even had it on their radar. A couple (these are
smart people on top of things) didn't even know exactly what WinRM is.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

HR> Marco Shaw [MVP] wrote:
HR>

>> I'd use WinRM if you're looking to run a DOS-style command:
>>
>> PS > get-content pclist.txt|foreach-object{winrs /r:$_ net user}
>>

HR> Brandon [MVP] wrote:
HR>

>> woah... smoking a little to much of the WinRM weed :)
>>

HR> Aside from Brandon (for whom we already know the answer :) ), I'm
HR> curious to know who has deployed and is using WinRM in any capacity
HR> right now? I'm not talking specifically about the PS V2 CTP
HR> remoting, because I know the Vista/2008 requirements push it beyond
HR> the applicability of many. In a more general sense, have you played
HR> with it at all?
HR>


IT STAFF

unread,
Jun 26, 2008, 9:35:41 PM6/26/08
to
Guys

Thanks for the powershell codes. While waiting for the input of the
professionals here, i manage in another way via batch file.

@echo off
cls

:: sets the filename that contains list of pc names
set filename=pclist.txt

:: Sets your password
set password=xxxxxx

:: Which account to change password
set admin=administrator


For /F %%i In (%filename%) Do Call :Ping4Name %%i

:Ping4Name
For /F "Tokens=2" %%a In ('ping -n 1 %1 ^| find /i "Reply"') Do (

cusrmgr.exe -u %admin% -m \\%1 -P %password% )
:eof


"Brandon Shell [MVP]" <a_bshe...@hotmail.com> wrote in message
news:29d4f6465fa78...@nn.bloomberg.com...

Flowering Weeds

unread,
Jun 27, 2008, 4:40:24 PM6/27/08
to

>> looking to run a DOS

DOS????

Y'all know there are still people
using DOS (the OS) and DOS
programs?

The rest of us are using Windows
(the OS) and Windows console
programs or Windows graphic
programs or newer Windows .NET
programs (console and graphic)! :)

> In a more general sense,
> have you played with it at all?

Mmm perhaps a more
"interesting" question is:

Who really thinks they have
_not_
used _any_ "WinRM parts"?

Yep, perhaps it is time to learn
modern Windows and the modern
Windows tools (like multi-processes
port sharing and even the Windows
data parser, Log Parser 2.2 with
built-in ChartSpace charting)!


dennydd

unread,
Jul 15, 2008, 5:19:12 PM7/15/08
to
Check out Accessing Server 2008 remotely using Windows Remote Shell

http://www.infotechguyz.com/server2008/wrms.html

dennydd

unread,
Jul 15, 2008, 5:20:15 PM7/15/08
to
<a href=http://www.infotechguyz.com/server2008/wrms.html>Check out Accessing Server 2008 remotely using Windows Remote Shell</a>


0 new messages