Monthly Archives: June 2015

Removing HomeDrive and HomeFolder settings

Back in this post https://richardspowershellblog.wordpress.com/wp-admin/post.php?post=2343&action=edit I showed how to set the users home directory and home drive. I was recently asked how to remove entries from those attributes. The easiest way is to use the –Clear parameter with set-AdUser Set-ADUser … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

CIM filters

I was looking up Win32_SystemDriver on the MSDN site and noticed there was some PowerShell example code Get-WmiObject -Class Win32_SystemDriver | Where-Object -FilterScript {$_.State -eq “Running”} | Where-Object -FilterScript {$_.StartMode -eq “Manual”} | Format-Table -Property Name,DisplayName A better way to … Continue reading

Posted in CIM, PowerShell and WMI, Powershell Basics | Leave a comment

Parsing ipconfig /displaydns with regular expressions

In yesterdays post I used a series of split operations to parse the strings produced by ipconfig /displaydns Regular expressions should give a more power full way to perform this task. Not being a big fan of regular expressions I … Continue reading

Posted in DNS, Networking, Powershell | Leave a comment

Parsing ipconfig /displaydns

  A recent question on the forum asked how you could get the contents on Windows 7 machines and earlier. On later machines – Windows 8 and above –  its easy because you can use Get-DnsClientCache from the DnsClient module. … Continue reading

Posted in DNS, Networking, PowerShellGet | 1 Comment

Scripting Games

See what’s happening with the Scripting Games –  http://blogs.technet.com/b/heyscriptingguy/archive/2015/06/27/powershell-spotlight-yeah-it-s-the-scripting-games.aspx   Thank about the requirements and offer to help as outlined in the article.

Posted in Scripting Games | Leave a comment

Multiple LDAP filters

Continuing our look at LDAP filters – remember the data set in use: £> Get-ADUser -SearchBase ‘OU=Testing,DC=Manticore,DC=org’  -Properties * -Filter * | select Name Name—-Dave GreenDave BrownDave WhiteJo DavenFred GreenDale GreensmithDave Greenly Individual filters work like this £> Get-ADUser -SearchBase … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

AD module cmdlets accepting LDAPfilter

In case you were wondering which cmdlets in the Active Directory module allowed you to use LDAP filters £> Get-Command -Module ActiveDirectory -ParameterName LDapFilter Name—-Get-ADAuthenticationPolicyGet-ADAuthenticationPolicySiloGet-ADCentralAccessPolicyGet-ADCentralAccessRuleGet-ADClaimTransformPolicyGet-ADClaimTypeGet-ADComputerGet-ADFineGrainedPasswordPolicyGet-ADGroupGet-ADObjectGet-ADOptionalFeatureGet-ADOrganizationalUnitGet-ADResourcePropertyGet-ADResourcePropertyListGet-ADResourcePropertyValueTypeGet-ADServiceAccountGet-ADTrustGet-ADUser

Posted in PowerShell and Active Directory | Leave a comment

Basic LDAP filters

I recently showed how to create an LDAP filter for an attribute that wasn’t set.  I thought it would be useful to show some other LDAP filters. The examples are from a testing OU in my AD £> Get-ADUser -SearchBase … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

DSC resources

  New DSC resources are available on the PowerShell gallery.  See http://blogs.msdn.com/b/powershell/archive/2015/06/23/dsc-resource-kit-flourishes-as-open-source.aspx for details. Note the comment about DSC resource kit will no longer be published as waves but will be updated on the PowerShell gallery as required. There is … Continue reading

Posted in Desired State Configuration, PowerShell v5 | Leave a comment

LDAP filter for a property that isn’t set

Filtering on a particular LDAP property is straight forward Get-ADUser -SearchBase ‘OU=Testing,DC=Manticore,DC=org’  -Properties * -Filter {Title -eq ‘Boss’} You can also use an LDAP filter Get-ADUser -SearchBase ‘OU=Testing,DC=Manticore,DC=org’  -Properties * -LDAPFilter ‘(Title=Boss)’ I prefer LDAP filters as I find them … Continue reading

Posted in PowerShell and Active Directory | Leave a comment