Skip to content

Instantly share code, notes, and snippets.

@mrhvid
mrhvid / MultiThred.ps1
Created August 21, 2015 16:27
Original code. I haven't been able to find creater from 2012 or earlier
function Multi-Thred {
Param($ScriptFile = $(Read-Host "Enter the script file"),
$ComputerList = $(Read-Host "Enter the Location of the computerlist"),
$MaxThreads = 20,
$SleepTimer = 500,
$MaxWaitAtEnd = 600,
$OutputType = "Return")
$Computers = Get-Content $ComputerList
$computers = Get-ADComputer –SearchBase 'OU=Test,DC=Test,DC=COM' -filter *
ForEach($computer in $computers)
{
$ComputerName = $computer.name
Remove-Item "\\$ComputerName\windows\ccmcache\*" -Force -recure
}