Powershell :- Test-Path and the -IsValid Option

Background In some cases one rushes through code and adds this and that in hopes to quickly get results. And, that is how I found myself using Test-Path and self sabotaging with the -IsValid Option. Script Powershell Code Output   Explanation In our test, we passed along a file that does not exist (c:\sam_was_here.txt) -IsValid … Continue reading Powershell :- Test-Path and the -IsValid Option

Visual Studio – Build – Error – “Exception: The process cannot access the file – obj’ because it is being used by another process.

Background Ran into a little error while trying to build a Visual Studio Project. Error Error Item Image Textual TroubleShooting Outline Trigger PowerShell build\buildtasks.ps1 Get-ChildItem -Recurse bin, obj -Directory | Remove-Item -Recurse -Force Tools Identify which processes are using the targeted folder Microsoft SysInternals handle Trigger Powershell build\buildtasks.ps1 The buildtasks.ps1 script issues this command :- … Continue reading Visual Studio – Build – Error – “Exception: The process cannot access the file – obj’ because it is being used by another process.

File System – Folder Sizes in Powershell

Background Needing to get folder sizes, but did not want to remote desktop to the machine and get the folder size using MS Windows Explorer. Code PowerShell Link Link Body https://gist.github.com/DanielAdeniji/f8f91de6cdeb5e92edb43d20b03287c4 Output  

Recycle Bin Emptying Using Powershell

Background One might find that the Recycle Bin is taking up a good chuck of storage. Remediation Powershell Let us use Powershell to dump our recycle bins. Cmdlet :- Clear-RecycleBin Syntax Here is the Syntax Sample All Drives Script Output Drive Letters Specified Script Output Confirm Confirm - True Script Output Explanation Prompted Confirm - … Continue reading Recycle Bin Emptying Using Powershell