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
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...
Does ADSI depend on RPC? Must try it someday.
Marco
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
---------------
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
---------------
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>
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...
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)!