Re: how to use psexec to defrag all my computers
- From: John John - MVP <audetweld@xxxxxxxxxxx>
- Date: Tue, 09 Jun 2009 11:55:45 -0300
Well, I'm not sure about the script but from the Command Prompt this simple command gets it going on my remotes:
psexec \\ComputerName defrag.exe c: -f
That is all that I need to have it run, no need for the -s - u or -p switches. With the FOR /f command as suggested by Shenan you should be able to get it going.
John
Rich wrote:
Yeah, all my machines have the same administrator username and password, i just think maybe I'm doing something wrong. below is what i was trying to do. I get a bunch of cmd windows to pop up, then they all close fairly quickly, i think saying the file or path can't be found. it disappears too quickly to see for sure..
set objFSO = CreateObject("Scripting.FileSystemObject")
set objShell = CreateObject("Wscript.Shell")
set objFile = objFSO.OpenTextFile("C:\documents and settings\Rich\desktop\computers.txt")
Do while not objFile.AtEndOfStream
currentpc = objFile.Readline
objShell.Run "c:\tools\psexec -s \\" ¤tpc &" -u administrator -p password " &Chr(34) & "c:\windows\system32\defrag.exe c: -f" &Chr(34)
Loop
"John John - MVP" wrote:
If you run it from a local administrator account it should have administrative privileges on the remote machine. You can also run it under the all powerful System account if you have to. Are all the remote machines using the same Administrator name and password? If yes run it from a local Administrator account with the same credentials, but if you are logged on as an administrator I don't think that should be necessary.
John
Rich wrote:I have a text file named computers.txt that lists all my workstations, one per line. For the life of me I can't figure out how to use this with psexec logging in as the local admin with a -u administrator to defrag all my workstations in this file. anyone have a working command line with the -u and -p in it they could share?
- References:
- how to use psexec to defrag all my computers
- From: Rich
- Re: how to use psexec to defrag all my computers
- From: John John - MVP
- Re: how to use psexec to defrag all my computers
- From: Rich
- how to use psexec to defrag all my computers
- Prev by Date: Re: how to use psexec to defrag all my computers
- Next by Date: Re: rtl100.bpl not found
- Previous by thread: Re: how to use psexec to defrag all my computers
- Next by thread: Re: how to use psexec to defrag all my computers
- Index(es):
Relevant Pages
|