Stay Connected
Posts tagged delete
PowerShell: How to delete a file based on a list of computers?
Jan 31st
The following PowerShell script recipe will help you delete a remote file based on a list of computers stored in a text file. New PowerShell function will be created during the session which will be piped from the text file.
Generate C:\Scripts\Active_Computers.txt with computer names.
[PowerShell]
function delete-remotefile {
PROCESS {
$file = "\\$_\c$\install.exe"
if (test-path $file)
{
echo "$_ install.exe exists"
Remove-Item $file -force
echo "$_ install.exe file deleted"
}
}
}
Get-Content C:\Scripts\Active_Computers.txt | delete-remotefile
[/PowerShell]
Help my windows server root volume is full!
Jun 25th
This morning my Cacti appliance warned me by email that the windows root volume was getting above the 90% threshold. I configured this a while ago for getting notified in front.
When installing and configuring this Windows server I didn’t plan the configuration in the right way and my free space for C:\ volume is limited. If you install a fresh server again think about having one volume using the complete physical RAID disk space and not having one 18GB disk as I used now. My main problem is that server has 4GB of RAM and paging file is sitting on C:\.
I was not able to move the paging file nor could I move the production virtual machine another volume. I went to C:\Windows and found a lot of blue directories which were used by the Automatic Updates. It used more than 500MB.
To safely remove Hotfix Backup files and the Add/Remove Programs Registry entries go to here and download the tool. Run the tool and remove all hotfixe backup files.
After you run the tool; go to c:\Windows and delete all blue marked directories. They all should start with $ sign.
Now we have on directory we need have closer look. Mine on this particular server grow to 600+ mb. Go to C:\WINDOWS\SoftwareDistribution\Download and verify your size.
Stop the “Automatic Updates” service or run “net stop wuauserv” from cmd.
Delete all subfolders within C:\WINDOWS\SoftwareDistribution\Download. Restart the “Automatic Updates” service. You can safely remote these. The procedure can be executed on a Windows XP or a Windows Server 2003 system.
Data really deleted???
May 18th
Today I moved my data using the robocopy.exe tool and using the /move switch; the tool migrated data from one usb disk to another one. Before returning my usb disk to the IT department I checked the disk partition with one of the tools I use to check deleted files. Guess what the tool found 18000 files in 10 minutes scan on the usb volume which was empty…
Before I will return this USB disk for re-use I will make sure no data is left which can be recovered by any tool. With physical disks I used gdisk with dod option to wipe all data. For the USB disk I am going to install tool called Eraser which is freeware.

