Monthly Archives: August 2018

//August

Cleaning up

Who doesn’t love cleaning up old files, don’t worry, Powershell comes to the rescue.

We all know that shared network drives collect all kind of garbage, and usually around 90% could actually be missed.

I’ve recently been working on cleaning up files which were created a long time ago, thanks to Powershell, we can script this action and make Powershell work for us.

What I do here is to look at the creation date of the files and delete them if they are older than 2 years old, so we set a limit to target only those who are old enough to be removed.

I recommend having backup of the files before running these Powershell scripts.

Logging the output is also recommending

(more…)

By |2018-08-09T22:30:51+00:00August 9th, 2018|Common, File|0 Comments

Playing with functions

Today I’m going to play around with functions.

I use functions to do repetitive admin tasks to make my life easier.

Functions can be simple and complex depending on your need, sometimes it’s static and won’t need any dynamic parameters.

Function Reset-WUFolder {
# Stop Windows update and BITS services
Stop-Service -Name wuauserv
Stop-Service -Name BITS
# Remove WU Folder
Remove-Item -Path $env:SystemRoot\SoftwareDistribution -Force
# Start Windows update and BITS services again
Start-Service -Name wuauserv
Start-Service -Name BITS
}

Run the code and you can call your function from the command line.

(more…)

By |2019-03-29T23:15:13+00:00August 3rd, 2018|Common, Operating System|0 Comments