PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about...

21
PsTools Copyright © 1999-2004 Mark Russinovich Sysinternals - www.sysinternals.com The Windows NT and Windows 2000 Resource Kits come with a number of command line tools that help you administer your Windows NT/2K systems. Over time, I've grown a collection of similar tools, including some not included in the Resource Kits. What sets these tools apart is that they all allow you to manage remote systems as well as the local one. The first tool in the suite was PsList, a tool that lets you view detailed information about processes, and the suite is continually growing. The "Ps" prefix in PsList relates to the fact that the standard UNIX process listing command-line tool is named "ps", so I've adopted this prefix for all the tools in order to tie them together into a suite of tools named PsTools. All of the utilities in the PsTools suite work on Windows NT, Windows 2000, Windows XP, and Server 2003 and none of the tools requires any special installation. You don't even need to install any client software on the remote computers at which you target them. Run them by typing their name and any command-line options you want. To show complete usage information, specify the "-?" command-line option. The tools included in the PsTools suite are: PsExec - execute processes remotely PsFile - shows files opened remotely PsGetSid - display the SID of a computer or a user PsInfo - list information about a system PsKill - kill processes by name or process ID PsList - list detailed information about processes PsLoggedOn - see who's logged on locally and via resource sharing PsLogList - dump event log records PsPasswd - changes account passwords PsService - view and control services PsShutdown - shuts down and optionally reboots a computer PsSuspend - suspend and resume processes

Transcript of PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about...

Page 1: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsToolsCopyright©1999-2004MarkRussinovichSysinternals-www.sysinternals.com

TheWindowsNTandWindows2000ResourceKitscomewithanumberofcommandlinetoolsthathelpyouadministeryourWindowsNT/2Ksystems.Overtime,I'vegrownacollectionofsimilartools,includingsomenotincludedintheResourceKits.Whatsetsthesetoolsapartisthattheyallallowyoutomanageremotesystemsaswellasthelocalone.ThefirsttoolinthesuitewasPsList,atoolthatletsyouviewdetailedinformationaboutprocesses,andthesuiteiscontinuallygrowing.The"Ps"prefixinPsListrelatestothefactthatthestandardUNIXprocesslistingcommand-linetoolisnamed"ps",soI'veadoptedthisprefixforallthetoolsinordertotiethemtogetherintoasuiteoftoolsnamedPsTools.

AlloftheutilitiesinthePsToolssuiteworkonWindowsNT,Windows2000,WindowsXP,andServer2003andnoneofthetoolsrequiresanyspecialinstallation.Youdon'tevenneedtoinstallanyclientsoftwareontheremotecomputersatwhichyoutargetthem.Runthembytypingtheirnameandanycommand-lineoptionsyouwant.Toshowcompleteusageinformation,specifythe"-?"command-lineoption.

ThetoolsincludedinthePsToolssuiteare:

PsExec-executeprocessesremotelyPsFile-showsfilesopenedremotelyPsGetSid-displaytheSIDofacomputerorauserPsInfo-listinformationaboutasystemPsKill-killprocessesbynameorprocessIDPsList-listdetailedinformationaboutprocessesPsLoggedOn-seewho'sloggedonlocallyandviaresourcesharingPsLogList-dumpeventlogrecordsPsPasswd-changesaccountpasswordsPsService-viewandcontrolservicesPsShutdown-shutsdownandoptionallyrebootsacomputerPsSuspend-suspendandresumeprocesses

Page 2: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

RequirementsSomeofthetoolsrequirethatthedefaultadmin$sharebeavailableand/orthattheRemoteRegistryservicebeactive.

LicenseNopartofPsToolsmayberedistributedinanyway,orbyanymeans,withoutthepriorwrittenpermissionofSysinternalsLLC.IfyouwishtoredistributePsTools,forexampleforusewithinanorganization,[email protected].

Page 3: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsExec

UtilitieslikeTelnetandremotecontrolprogramslikeSymantec'sPCAnywhereletyouexecuteprogramsonremotesystems,buttheycanbeapaintosetupandrequirethatyouinstallclientsoftwareontheremotesystemsthatyouwishtoaccess.PsExecisalight-weighttelnet-replacementthatletsyouexecuteprocessesonothersystems,completewithfullinteractivityforconsoleapplications,withouthavingtomanuallyinstallclientsoftware.PsExec'smostpowerfulusesincludelaunchinginteractivecommand-promptsonremotesystemsandremote-enablingtoolslikeIpConfigthatotherwisedonothavetheabilitytoshowinformationaboutremotesystems.

InstallationCopyPsExecontoyourexecutablepath.Typing"psexec"displaysitsusagesyntax.

Usageusage:[\\computer[,computer[,...]|@file][-uuser[-ppsswd]][-ns][-s|-e][-i][-c[-f|-v]][-d][-wdirectory][-<priority>][-an,n,...>]cmd[arguments]

computerDirectPsExectoruntheapplicationonthecomputerorcomputersspecified.IfyouomitthecomputernamePsExecrunstheapplicationonthelocalsystemandifyouenteracomputernameof\\*thenPsExecexecutesthecommandsonallcomputersinthecurrentdomain.

@file PsExecwillexecutethecommandoneachofthecomputerslistedinthefile. -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

-s RunremoteprocessintheSystemaccount. -e Loadsthespecifiedaccount'sprofile. -i Runtheprogramsothatitinteractswiththedesktopontheremotesystem.

-c Copythespecifiedprogramtotheremotesystemforexecution.Ifyouomitthisoptionthentheapplicationmustbeinthesystem'spathontheremotesystem.

-n Specifiestimeoutinsecondsconnectingtoremotecomputers.

-f Forcethecopyofthespecifiedprogramifitalreadyexistsontheremotesystem.

-v Copythespecifiedfileonlyifithasahigherversionnumberorisneweronthantheoneontheremotesystem.

Page 4: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

-d Don'twaitforapplicationtoterminate.Onlyusethisoptionfornon-interactiveapplications.

-w Settheworkingdirectoryoftheprocess(relativetotheremotecomputer).

-priority Specifies-low,-belownormal,-abovenormal,-highor-realtimetoruntheprocessatadifferentpriority.

-aSeparateprocessorsonwhichtheapplicationcanrunwithcommaswhere1isthelowestnumberedCPU.Forexample,toruntheapplicationonCPU2andCPU4,enter:"-a2,4"

arguments Argumentstopass(notethatfilepathsmustbeabsolutepathsonthetargetsystem)

Youcanencloseapplicationsthathavespacesintheirnamewithquotationmarkse.g."psexec\\marklap"c:\longname\app.exe".Putargumentsdirectedattheapplicationoutsideoftheparenthesis.Inputisonlypassedtotheremotesystemwhenyoupresstheenterkey,andtypingCtrl-Cterminatestheremoteprocess.

IfyouomitausernametheremoteprocessrunsinthesameaccountfromwhichyouexecutePsExec,butbecausetheremoteprocessisimpersonatingitwillnothaveaccesstonetworkresourcesontheremotesystem.Whenyouspecifyausernametheremoteprocessexecutesintheaccountspecified,andwillhaveaccesstoanynetworkresourcestheaccounthasaccessto.Notethatthepasswordistransmittedincleartexttotheremotesystem.

ExamplesThefollowingcommandlaunchesaninteractivecommandprompton\\marklap:

psexec\\marklapcmd

ThiscommandexecutesIpConfigontheremotesystemwiththe/allswitch,anddisplaystheresultingoutputlocally:

psexec\\marklapipconfig/all

Thiscommandcopiestheprogramtest.exetotheremotesystemandexecutesitinteractively:

psexec\\marklap-ctest.exe

Page 5: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

Specifythefullpathtoaprogramthatisalreadyinstalledonaremotesystemifitsnotonthesystem'spath:

psexec\\marklapc:\bin\test.exe

Page 6: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsFile

The"netfile"commandshowsyoualistofthefilesthatothercomputershaveopenedonthesystemuponwhichyouexecutethecommand,howeverittruncateslongpathnamesanddoesn'tletyouseethatinformationforremotesystems.PsFileisacommand-lineutilitythatshowsalistoffilesonasystemthatareopenedremotely,anditalsoallowsyoutocloseopenedfileseitherbynameorbyafileidentifier.

InstallationCopyPsFileontoyourexecutablepathandtype"psfile".

UsageThedefaultbehaviorofPsFileistolistthefilesonthelocalsystemthatareopenbyremotesystems.Typingacommandfollowedby"-?"displaysinformationonthesyntaxforthecommand.

usage:psfile[\\RemoteComputer[-uUsername[-pPassword]]][[Id|path][-c]] -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

Id Identifier(asassignedbyPsFile)ofthefileforwhichtodisplayinformationortoclose.

Path Fullorpartialpathoffilestomatchforinformationdisplayorclose. -c ClosesthefilesidentifedbyIDorpath.

Page 7: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsGetSid

HaveyouperformedarolloutandonlytodiscoverthatyournetworkmightsufferfromtheSIDduplicationproblem?InordertoknowwhichsystemshavetobeassignedanewSID(usingaSIDupdaterlikeSysinternals'ownNewSID)youhavetoknowwhatacomputer'smachineSIDis.Upuntilnowthere'sbeennowaytotellthemachineSIDwithoutknowingRegedittricksandexactlywheretolookintheRegistry.PsGetSidmakesreadingacomputer'sSIDeasy,andworksacrossthenetworksothatyoucanquerySIDsremotely.PsGetSidalsoletsyouseetheSIDsofuseraccounts.

InstallationCopyPsPsGetSidontoyourexecutablepathandtype"psgetsid".

UsageUsage:psgetsid[\\computer[,computer[,...]|@file[-uusername[-ppassword]]][account]Ifyouwanttoseeacomputer'sSIDjustpassthecomputer'snameasacommand-lineargument.Ifyouwanttoseeauser'sSID,nametheaccount(e.g."administrator")onthecommand-lineandanoptionalcomputername.

Specifyausernameiftheaccountyouarerunningfromdoesn'thaveadministrativeprivilegesonthecomputeryouwanttoquery.Ifyoudon'tspecifyapasswordasanoptionPsGetSidwillpromptyouforonesothatyoucantypeitinwithouthavingitechoedtothedisplay.

Page 8: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsInfo

PsInfoisacommand-linetoolthatgatherskeyinformationaboutthelocalorremotesystem,includingthetypeofinstallation,kernelbuild,registeredorganizationandowner,numberofprocessorsandtheirtype,memorysize,theinstalldateofthesystem,andifit'satrialversion,theexpirationdate.PsInfocommand-lineswitchesalsoletyouviewinstalledhotfixesandsoftwareapplications.

InstallationCopyPsInfoontoyourexecutablepathandtypepsinfo.

UsageBydefaultPsInfoshowsinformationforthelocalsystem.Specifyaremotecomputernametoobtaininformationfromtheremotesystem.SincePsInforeliesonremoteRegistryaccesstoobtainitsdata,theremotesystemmustberunningtheRemoteRegistryserviceandtheaccountfromwhichyourunPsInfomusthaveaccesstotheHKLM\SystemportionoftheremoteRegistry.

InordertoaidinautomatedServicePackupdates,PsInforeturnsasavaluetheServicePacknumberofsystem(e.g.0fornoservicepack,1forSP1,etc).

usage:psinfo[\\computer[,computer[,...]|@file[-uusername[-ppassword]]][-h][-s][-d][-c[-tdelimter]]

computerRunthecommandonthecomputerorcomputersspecified.Ifyouomitthecomputernamethecommandrunsonthelocalsystemandifyouenteracomputernameof\\*thenthecommandrunsonallcomputersinthecurrentdomain.

@file Executethecommandoneachofthecomputerslistedinthefile. -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

-h Showsinstalledhotfixes. -s Showsinstalledsoftware. -d Showdiskvolumeinformation.

-c DumpinCSVformat.

Page 9: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

-t Thedefaultdelimiterforthe-soptionisacomma,butcanbeoverridenwiththe

specifiedcharacter.

Page 10: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsKill

WindowsNT/2000doesnotcomewithacommand-line'kill'utility.YoucangetoneintheWindowsNTorWin2KResourceKit,butthekit'sutilitycanonlyterminateprocessesonthelocalcomputer.PsKillisakillutilitythatnotonlydoeswhattheResourceKit'sversiondoes,butcanalsokillprocessesonremotesystems.Youdon'tevenhavetoinstallaclientonthetargetcomputertousePsKilltoterminatearemoteprocess.

InstallationCopyPsKillontoyourexecutablepathandtypepskillwithcommand-lineoptionsdefinedbelow.

UsageRunningPsKillwithaprocessIDdirectsittokilltheprocessofthatIDonthelocalcomputer.IfyouspecifyaprocessnamePsKillwillkillallprocessesthathavethatname.

usage:pskill[-t][\\computer[-uusername][-ppassword]]<processname|processid> -t Killtheprocessanditsdescendants. -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

processid SpecifiestheprocessIDoftheprocessyouwanttokill.

processname Specifiestheprocessnameoftheprocessorprocessesyouwanttokill.

Page 11: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsList

MostUNIXoperatingsystemsshipwithacommand-linetoolcalled"ps"(orsomethingequivalent)thatadministratorsusetoviewdetailedinformationaboutprocessCPUandmemoryusage.WindowsNT/2Kcomeswithnosuchtoolnatively,butyoucanobtainsimilartoolswiththeWindowsNTWorkstationorServerResourceKits.ThetoolsintheResourceKits,pstatandpmon,showyoudifferenttypesofinformation,andwillonlydisplaydataregardingtheprocessesonthesystemonwhichyourunthetools.

PsListisutilitythatshowsyouacombinationoftheinformationobtainableindividuallywithpmonandpstat.YoucanviewprocessCPUandmemoryinformation,orthreadstatistics.WhatmakesPsListmorepowerfulthantheResourceKittoolsisthatyoucanviewprocessandthreadstatisticsonaremotecomputer.

InstallationCopyPsListontoyourexecutablepathandtype"pslist".

UsageThedefaultbehaviorofPsLististoshowCPU-orientedinformationforalltheprocessesthatarecurrentlyrunningonthelocalsystem.Theinformationlistedforeachprocessincludesthetimetheprocesshasexecuted,theamountoftimetheprocesshasexecutedinkernelandusermodes,andtheamountofphysicalmemorythattheOShasassignedtheprocess.Command-lineswitchesallowyoutoviewmemory-orientedprocessinformation,threadstatistics,orallthreetypesofdata.

usage:pslist[-?][-d][-m][-x][-t][-s[n][-rn][\\computer[-uusername][-ppassword]][[-e]name|pid] -d ThisswitchhasPsListshowstatisticsforallactivethreadsonthesystem,

groupingthreadswiththeirowningprocess.

-m ThisswitchhasPsListshowmemory-orientedinformationforeachprocess,ratherthanthedefaultofCPU-orientedinformation.

-x WiththisswitchPsListshowsCPU,memoryandthreadinformationforeachof

Page 12: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

theprocessesspecified. -t Showprocesstree.

-s[n] Runintask-managermode,foroptionalsecondsspecified.PressEscapetoabort.

-rn Task-managermoderefreshrateinseconds(defaultis1). -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

name

Insteadoflistingalltherunningprocessesinthesystem,thisparameternarrowsPsList'sscantothoseprocessesthatbeginwiththenameprocess.Thus:

pslistexp

wouldstatisticsforalltheprocessesthatstartwith"exp",whichwouldincludeExplorer.

-e Usethe-eswitchifyouwanttheprocessnametobetreatedasanexactmatchinsteadofapartialmatch.

pid

Insteadoflistingalltherunningprocessesinthesystem,thisparameternarrowsPsList'sscantotheprocessthathasthespecifiedPID.Thus:

pslist53

woulddumpstatisticsfortheprocesswiththePID53.

Page 13: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsLoggedOn

Youcandeterminewhoisusingresourcesonyourlocalcomputerwiththe"net"command("netsession"),however,thereisnobuilt-inwaytodeterminewhoisusingtheresourcesofaremotecomputer.Inaddition,NTcomeswithnotoolstoseewhoisloggedontoacomputer,eitherlocallyorremotely.PsLoggedOnisanappletthatdisplaysboththelocallyloggedonusersandusersloggedonviaresourcesforeitherthelocalcomputer,oraremoteone.Ifyouspecifyausernameinsteadofacomputer,PsLoggedOnsearchesthecomputersinthenetworkneighborhoodandtellsyouiftheuseriscurrentlyloggedon.

PsLoggedOn'sdefinitionofalocallyloggedonuserisonethathastheirprofileloadedintotheRegistry,soPsLoggedOndetermineswhoisloggedonbyscanningthekeysundertheHKEY_USERSkey.ForeachkeythathasanamethatisauserSID(securityIdentifier),PsLoggedOnlooksupthecorrespondingusernameanddisplaysit.Todeterminewhoisloggedontoacomputerviaresourceshares,PsLoggedOnusestheNetSessionEnumAPI.NotethatPsLoggedOnwillshowyouasloggedonviaresourcesharetoremotecomputersthatyouquerybecausealogonisrequiredforPsLoggedOntoaccesstheRegistryofaremotesystem.

InstallationCopyPsLoggedOnontoyourexecutablepathandtype"psloggedon".

Usageusage:psloggedon[-?][-l][-x][\\computername|username] -l Showsonlylocallogonsinsteadofbothlocalandnetworkresourcelogons. -x Don'tshowlogontimes. \\computername Specifiesthenameofthecomputerforwhichtolistlogoninformation.

usernameIfyouspecifyausernamePsLoggedOnsearchesthenetworkforcomputerstowhichthatuserisloggedon.Thisisusefulifyouwanttoensurethataparticularuserisnotloggedonwhenyouareabouttochangetheiruserprofileconfiguration.

Page 14: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsLogList

TheResourceKitcomeswithautility,elogdump,thatletsyoudumpthecontentsofanEventLogonthelocaloraremotecomputer.PsLogListisacloneofelogdumpexceptthatPsLogListletsyoulogintoremotesystemsinsituationsyourcurrentsetofsecuritycredentialswouldnotpermitaccesstotheEventLog,andPsLogListretrievesmessagestringsfromthecomputeronwhichtheeventlogyouviewresides.

InstallationCopyPsLogListontoyourexecutablepathandtype"psloglist".

UsageThedefaultbehaviorofPsLogLististoshowthecontentsoftheSystemEventLogonthelocalcomputer,withvisually-friendlyformattingofEventLogrecords.Commandlineoptionsletyouviewlogsondifferentcomputers,useadifferentaccounttoviewalog,ortohavetheoutputformattedinastring-searchfriendlyway.

usage:psloglist[-?][\\computer[,computer[,...]|@file[-uusername[-ppassword]]][-s[-tdelimiter]][-m#|-n#|-h#|-d#|-w][-c][-x][-r][-amm/dd/yy][-bmm/dd/yy][-ffilter][-iID[,ID[,...]|-eID[,ID[,...]]][-oeventsource[,eventsource][,..]]][-qeventsource[,eventsource][,..]]][-leventlogfile]<eventlog> @file Executethecommandoneachofthecomputerslistedinthefile. -a Dumprecordstimestampedafterspecifieddate. -b Dumprecordstimestampedbeforespecifieddate. -c Cleartheeventlogafterdisplaying. -d Onlydisplayrecordsfrompreviousndays. -e ExcludeeventswiththespecifiedIDorIDs(upto10). -f Filtereventtypeswithfilterstring(e.g."-fw"tofilterwarnings). -h Onlydisplayrecordsfrompreviousnhours. -i ShowonlyeventswiththespecifiedIDorIDs(upto10). -l Dumprecordsfromthespecifiedeventlogfile. -m Onlydisplayrecordsfrompreviousnminutes. -n Onlydisplaythenumberofmostrecententriesspecified. -o Showonlyrecordsfromthespecifiedeventsource(e.g.\"-ocdrom\").

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

Page 15: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

-q Omitrecordsfromthespecifiedeventsourceorsources(e.g.\"-ocdrom\"). -r Dumplogfromleastrecenttomostrecent.

-s

ThisswitchhasPsLogListprintEventLogrecordsone-per-line,withcommadelimitedfields.Thisformatisconvenientfortextsearches,e.g.psloglist|findstr/itext,andforimportingtheoutputintoaspreadsheet.

-t Thedefaultdelimeterisacomma,butcanbeoverridenwiththespecifiedcharacter. -u Specifiesoptionalusernameforlogintoremotecomputer. -w Waitfornewevents,dumpingthemastheygenerate. -x Dumpextendeddata.

eventlogBydefaultPsLogListshowsthecontentsoftheSystemEventLog.Specifyadifferenteventlogbytypinginthefirstfewlettersofthelogname,application,system,orsecurity.

Page 16: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsPasswd

Systemsadministratorsthatmanagelocaladministrativeaccountsonmultiplecomputersregularlyneedtochangetheaccountpasswordaspartofstandardsecuritypractices.PsPasswdisatoolthatletsyouchangeanaccountpasswordonthelocalorremotesystems,enablingadministratorstocreatebatchfilesthatrunPsPasswdagainstthecomputer'stheymanageinordertoperformamasschangeoftheadministratorpassword.

InstallationCopyPsPasswdontoyourexecutablepathandtypepspasswdwithcommand-lineoptionsdefinedbelow.

UsageYoucanusePsPasswdtochangethepasswordofalocalordomainaccountonthelocaloraremotecomputer.

usage:pspasswd[\\computer[,computer[,...]|@file[-uusername[-ppassword]]]Username[NewPassword]]

computerRunthecommandonthecomputerorcomputersspecified.Ifyouomitthecomputernamethecommandrunsonthelocalsystemandifyouenteracomputernameof\\*thenthecommandrunsonallcomputersinthecurrentdomain.

@file Executethecommandoneachofthecomputerslistedinthefile. -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

Username Specifiesnameofaccountforpasswordchange. NewPassword Newpassword.IfommittedaNULLpasswordisapplied.

Page 17: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsService

PsServiceisaserviceviewerandcontrollerforWindowsNT/2K.LiketheSCutilitythat'sincludedintheWindowsNTandWindows2000ResourceKits,PsServicedisplaysthestatus,configuration,anddependenciesofaservice,andallowsyoutostart,stop,pause,resumeandrestartthem.UnliketheSCutility,PsServiceenablesyoutologontoaremotesystemusingadifferentaccount,forcaseswhentheaccountfromwhichyourunitdoesn'thaverequiredpermissionsontheremotesystem.PsServiceincludesauniqueservice-searchcapability,whichidentifiesactiveinstancesofaserviceonyournetwork.YouwouldusethesearchfeatureifyouwantedtolocatesystemsrunningDHCPservers,forinstance.

Finally,PsServiceworksonbothNT4andWindows2000,whereastheWindows2000ResourceKitversionofSCrequiresWindows2000,andPsServicedoesn'trequireyoutomanuallyentera"resumeindex"inordertoobtainacompletelistingofserviceinformation.

InstallationCopyPsServiceontoyourexecutablepathandtype"psservice".

UsageThedefaultbehaviorofPsServiceistodisplaytheconfiguredservices(bothrunningandstopped)onthelocalsystem.Enteringacommandonthecommand-lineinvokesaparticularfeature,andsomecommandsacceptoptions.Typingacommandfollowedby"-?"displaysinformationonthesyntaxforthecommand.

usage:psservice[\\computer[-uusername][-ppassword]]<command><options> -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

query Displaysthestatusofaservice config Displaystheconfigurationofaservice setconfig Specifythestarttype(auto,demand,disabled)ofaservice.

Page 18: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

start Startsaservice stop Stopsaservice restart Stopsandthenrestartsaservice pause Pausesaservice cont Resumesapausedservice depend Liststheservicesdependentontheonespecified find Searchesthenetworkforthespecifiedservice

Page 19: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsShutdown

PsShutdownisasimilartotheResourceKitandWindowsXPshutdowntools,providingyouthesameoptionsandabilitytoshutdown,andoptionallyreboot,localandremoteWindowsNT/2K/XP/2003systems.Italsoprovidedadditionaloptionsthatmakeitmorepowerfulandflexible.

InstallationCopyPsShutdownontoyourexecutablepathandtype"psshutdown"withcommand-lineoptionsdefinedbelow.

UsageYoucanusePsShutdowntoinitiateashutdownofthelocaloraremotecomputer,abortanimminentshutdown,logoffaconsoleuser,orlockthedesktop.

usage:psshutdown[\\computer[,computer[,...]|@file[-uusername[-ppassword]]]-s|-r|-h|-d|-k|-a|-l|-o[-f][-c][-ns][-tnn|h:m][-e[u|p]:xx:yy][-m"message"]

computerRunthecommandonthecomputerorcomputersspecified.Ifyouomitthecomputernamethecommandrunsonthelocalsystemandifyouenteracomputernameof\\*thenthecommandrunsonallcomputersinthecurrentdomain.

@file Executethecommandoneachofthecomputerslistedinthefile. -u Specifiesoptionalusernameforlogintoremotecomputer

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

-a Abortsashutdown(onlypossiblewhileacountdownisinprogress) -c Allowtheshutdowntobeabortedbytheinteractiveuser

-eShutdownreasoncode.Specify'u'foruserreasoncodesand'p'forplannedshutdownreasoncodes.xxisthemajorreasoncode(mustbelessthan256)yyistheminorreasoncode(mustbelessthan65536)

-f Forcesallrunningapplicationstoexitduringtheshutdowninsteadofgivingthemachancetogracefullysavetheirdata

-h Hibernatethecomputer -k Poweroffthecomputer(rebootifpoweroffisnotsupported -l Lockthecomputer

-m Thisoptionletsyouspecifyamessagetodisplaytologged-onuserswhenashutdowncountdowncommences

-n Specifiestimeoutinsecondsconnectingtoremotecomputers -o Logofftheconsoleuser

Page 20: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

-r Rebootaftershutdown -s Shutdownwithoutpoweroff

-t Specifiesthecountdowninsecondsuntiltheshutdown(default:20seconds)orthetimeofshutdownin24hournotation

-vDisplaymessageforthespecifiednumberofsecondsbeforetheshutdown.Ifyouomitthisparametertheshutdownnotificationdialogdisplaysandspecifyingavalueof0omitsthedialog.

Page 21: PsTools - documentation.help · PsInfo is a command-line tool that gathers key information about the local or remote system, including the type of installation ... @file Execute the

PsSuspend

PsSuspendletsyoususpendprocessesonthelocaloraremotesystem,whichisdesirableincaseswhereaprocessisconsumingaresource(e.g.network,CPUordisk)thatyouwanttoallowdifferentprocessestouse.Ratherthankilltheprocessthat'sconsumingtheresource,suspendingpermitsyoutoletitcontinueoperationatsomelaterpointintime.

InstallationCopyPsSuspendontoyourexecutablepathandtype"pssuspend"withcommand-lineoptionsdefinedbelow.

UsageRunningPsSuspendwithaprocessIDdirectsittosuspendtheprocessofthatIDonthelocalcomputer.IfyouspecifyaprocessnamePsSuspendwillsuspendallprocessesthathavethatname.Specifythe-rswitchtoresumesuspendedprocesses.usage:pssuspend[-r][\\computer[-uusername][-ppassword]]<processname|processid> -r Resumessuspendedprocesses. -u Specifiesoptionalusernameforlogintoremotecomputer.

-p Specifiesoptionalpasswordforusername.Ifyouomitthisyouwillbepromptedtoenterahiddenpassword.

processid SpecifiestheprocessIDoftheprocessyouwanttosuspend.

processname Specifiestheprocessnameoftheprocessorprocessesyouwanttosuspend.