Using PsExec to delete old local profiles on lab machines

From WolfTech
Jump to navigation Jump to search

PsExec is a software tool that allows you to remotely push out files and patches. The link to download PsExec is listed below. An Example of using PsExec is to remotely delete old Profiles. For this I needed to download Delprof.exe from Microsoft. I also profided the link below. I then copied the files to a Network Share. I then created a local .bat file called del.bat. Here is the line I used in the bat file.

\\wolftech.ad.ncsu.edu\files\cnr\packages\cnr\Profiles\delprof /q /I /d:60

I then saved a list of IPs in my labs to a txt file. You can use computer names too. In my example I used a file called biltmorelabs.txt.

note: I copied the Psexec,del.bat and the txt files to a folder called profiles.

Then from a cmd line I ran the following command to delete the old profiles.



psexec @c:\profiles\biltmorelabs.txt -U wolftech\rdnorris.admin -c "c:\profiles\del.bat"

After I hit enter I am prompted for my password. It should delete the profiles and give you an error code 0 if the running of the delprof.exe is successful.



http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

http://www.microsoft.com/downloads/details.aspx?familyid=901a9b95-6063-4462-8150-360394e98e1e&displaylang=en

Retrieved from "http://www.wolftech.ncsu.edu/support/support/PStools"