Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Thursday, October 25, 2018

How to retrieve DN of AD parent object in Powershell

Stumbling over https://www.akaplan.com/blog/2015/09/get-the-parent-ou-for-an-ad-object/ I thought about how to do it correct AND fast:

$U = Get-ADUser $env:username -Properties cn
$uParent =$u.DistinguishedName.Substring( ( $u.cn ).Length + 4 )

This way we can use the fast string method and we will always remove up to the correct position. Regardless of the parent object container type (OU, Container, whatever...)

Tuesday, July 25, 2017

Mirroring AD OU trees including GPOs - the PoSh way

Hello all.

In your AD, there might be an OU tree for production purposes. There might be a second tree for testing purposes. Now you need a third tree for evaluation purposes. That means copying all OUs from one of the existing trees and re-linking all GPOs linked to the source.

I recently had this requirement for an OU structure 6 levels deep with more than 100 linked GPOs. Hard to believe I would do this manually, so I fired up my ISE and came out with this module:

CopyGPOLink

Since the description in the gallery is somewhat crispy, here's the full help:

Monday, November 07, 2016

Updating Gallery Modules - with a module, of course!

...after I dealt with module updates last week, I finally converted the stuff to a module and published it: https://www.powershellgallery.com/packages/UpdateInstalledModule/1.0

Have fun! :-)

Wednesday, November 02, 2016

Speed-updating powershell modules from the gallery

Hi all.

TL;DR: Update all your PoSH modules from PowershellGallery.com within your ISE profile - and with lightning speed!

I recently received a IseSteroids License due to being an MVP - many thanks to Tobias Weltner for this valuable gift!

I then started to think about "how do I keep IseSteroids" up to date? It receives minor updates quite frequently, so I tried this simple command in my personal ISE profile:

Update-Module -Name IseSteroids

This was a "no brainer" - update-module is a slow running thing. So ok, lets go - google/bing/whatever. I finally came up with a solution that has "history":