windows

By steve, 25 November, 2016

I just found the following utility that could be used to remove roaming profiles that have not been used in more than X days:
https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/

The only options I could find in GPO/Registry are delete profile immediately on log-off, or delete ALL profiles (including local) after X days of inactivity on machine reboot. Neither of these options are ideal for managing roaming profiles.

By steve, 15 February, 2016

I was recently involved in troubleshooting an issue where an on-premis exchange deployment was bouncing e-mails with an error that the user did not have an MDB assigned. This was a multi-tenant exchange deployment, so we could not use the official hybrid mode, but we were using one of the sync tools to keep usernames and passwords for the local users in sync with the office 365 users.

By steve, 11 January, 2016

To list all WMI performance counter sources, the following powershell command can be used:

Get-WmiObject -List

You can also have a look at the counters available using

Get-WmiObject -Class _ClassName_

Tags

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, 18 August, 2015

Windows password policies through GPO are applied at the computer level. If a GPO is with a computer password policy is applied at the top “domain” level, it affects all users in AD. If a GPO with a computer password policy is applied at an OU level, it affects all local accounts on any computer that is in the affected OU tree.

By steve, 29 April, 2014

I needed to change the firewall profile for a network adapter from public to private in windows server 2012. The only way I could work out to do it was using the following registry edit:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{}

The value of Category is set as follows for the firewall profile:

Public = 0
Private = 1
Domain = 2

You need to match the detected network setting with the ProfileName key under the GUID, and modify the Category value as required.

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