powershell

By steve, 16 December, 2015

To view all host file entries for all machines (assuming the machine you are on has the AD powershell modules, and can reach all machines):

foreach ($comp in Get-ADComputer -Filter * -Properties Description | Where-Object { $_.Description.Length -eq 0 -or $_.Description -ne "Failover cluster virtual network name account" }) 
{ 
	$hostfile= "\\"+ $comp.name +"\c$\windows\system32\drivers\etc\hosts"; 
	$comp.name; 
	$data=Get-Content $hostfile;
	foreach($line in $data) {
		if($line.Length -eq 0 -or $line.StartsWith("#")) {
			continue;
		}
		$line
	}
}
By steve, 10 April, 2014

the following powershell can be used to find all VSS scheduled tasks and alter the minutes to a random value.

$TaskService = new-object -comobject "Schedule.Service"
$TaskService.Connect()

$Folder = $TaskService.GetFolder("\")
$Task = $folder.GetTasks(0) | where {$_.Name.StartsWith("ShadowCopyVolume")}

if($Task.GetType().BaseType.Name -eq "Array") {
exit 1
}

$SetMinute=Get-Random -Minimum 1 -Maximum 59
$TaskDef=$Task.Definition