Audit Objects in your Domain(s) using switch statements in PowerShell

I find it important to figure out who and what is in your active directory OUs get-aduser $TargetedUser What about groups, and computers? get-adobject $targetObject this includes users, groups, and computers. here is a switch that will report differently based on object class property that gets returned. get-adobject -filter *| foreach-object{ Switch($_.Objectclass) { User{ write-hostContinue reading “Audit Objects in your Domain(s) using switch statements in PowerShell”

Add-Member if you want to effectively “object” all things and possess their property.

I thought I would clarify this as most articles don’t simplify this to easily wrap you head around. Add-member is what I would use to add a new member to a group of properties on an object I create the object  Add a noteproperty that translate to text create a scriptmethod that can do thingsContinue reading “Add-Member if you want to effectively “object” all things and possess their property.”

Try & Catching Errors so you can relax Finally.

Sometimes you gotta Try…. okay enough pep talk. using the Try Command will allow you to catch any terminating errors. unless you specify for some commands you will not catch the errors and may not want to actually. example:  Try{ get-childitem c:\incorrectlyspelledfolder\  -erroraction Stop -recurse -errorvariable ErrorCity} #for every Try there must be a catchContinue reading “Try & Catching Errors so you can relax Finally.”

Creating Objects for a personalized report or set of objects to pass to other cmdlets (Splatting or Hash)

so I seen this exchange command Get-ReceiveConnector  is a neat cmd-let that allows for you to grab some quick information. but lets say the information was incorrect and you wanted to set up a newer connecter for Exchange. you Stuff it in an Object: $StuffedObject= Get-ReceiveConnector Short Way : Clean New-recieveConnecter  @stuffedObject -whatif Long Way:Continue reading “Creating Objects for a personalized report or set of objects to pass to other cmdlets (Splatting or Hash)”