header image

Archive for June, 2015

Removing HomeDrive and HomeFolder settings

Posted by: | June 30, 2015 Comments Off on 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 -Identity gdreen -Clear HomeDrive, HomeDirectory

under: PowerShell and Active Directory

CIM filters

Posted by: | June 29, 2015 Comments Off on 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 write this would be: Get-WmiObject -Class Win32_SystemDriver -Filter "State=’Running’ AND StartMode=’Manual’" | Format-Table […]

under: CIM, PowerShell and WMI, PowerShell Basics

Parsing ipconfig /displaydns with regular expressions

Posted by: | June 29, 2015 Comments Off on 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 tend not to use them but for the sake of experimentation I thought I’d […]

under: DNS, Networking, PowerShell

Parsing ipconfig /displaydns

Posted by: | June 28, 2015 Comments Off on 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. This module is based on CIM classes that aren’t present on Windows 7 and earlier […]

under: DNS, Networking, PowerShell

Scripting Games

Posted by: | June 27, 2015 Comments Off on 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.

under: Scripting Games

Multiple LDAP filters

Posted by: | June 27, 2015 Comments Off on 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 Green Dave Brown Dave White Jo Daven Fred Green Dale Greensmith Dave Greenly   Individual filters work like this £> Get-ADUser -SearchBase ‘OU=Testing,DC=Manticore,DC=org’  -Properties * -LDAPFilter ‘(givenName=Fred)’ | […]

under: PowerShell and Active Directory

AD module cmdlets accepting LDAPfilter

Posted by: | June 26, 2015 Comments Off on 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-ADAuthenticationPolicy Get-ADAuthenticationPolicySilo Get-ADCentralAccessPolicy Get-ADCentralAccessRule Get-ADClaimTransformPolicy Get-ADClaimType Get-ADComputer Get-ADFineGrainedPasswordPolicy Get-ADGroup Get-ADObject Get-ADOptionalFeature Get-ADOrganizationalUnit Get-ADResourceProperty Get-ADResourcePropertyList Get-ADResourcePropertyValueType Get-ADServiceAccount Get-ADTrust Get-ADUser

under: PowerShell and Active Directory

Basic LDAP filters

Posted by: | June 26, 2015 Comments Off on 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 ‘OU=Testing,DC=Manticore,DC=org’  -Properties * -Filter * | select Name Name —- Dave Green Dave Brown Dave […]

under: PowerShell and Active Directory

DSC resources

Posted by: | June 24, 2015 Comments Off on 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 also a post showing some examples of writing DSC resources against a […]

under: Desired State Configuration, PowerShell v5

LDAP filter for a property that isn’t set

Posted by: | June 23, 2015 Comments Off on 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 more powerful and the I can use them in the GUI tools. I […]

under: PowerShell and Active Directory

Older Posts »

Categories