Writing Functions in PowerShell

I would like to propose we should all function as adults at some point in life. maybe not 24 hours a day but enough to take care of ourselves. PowerShell is an area that need you to be functioning to preserve your sanity and time, I will cover simple & advanced functions. A function canContinue reading “Writing Functions in PowerShell”

Troubleshooting Desktop Issues with Get-Eventlog

in the event you need to check your computer events to track down issues with your machine I must implore you to use “get-EventLog”   use this to your advantage to pinpoint issues.   in the image I used : Get-EventLog -LogName system -Newest 1 -EntryType Error | Format-List   mainly to for word wrapContinue reading “Troubleshooting Desktop Issues with Get-Eventlog”

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)”

Robocopy and PowerShell working in harmony.

  So lets create a scenario,  and say that they were having difficulty using Robocopy commands within or with PowerShell. Here’s a demonstration of how to use PowerShell to be able to deliver seamless and accurate commands that will ensure that you will have your data copied and have your PowerShell script. The best partContinue reading “Robocopy and PowerShell working in harmony.”