Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2

Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2

  • Comments 3
  • Likes

At today's CANITPRO camp entitled Managing your Datacenter with Windows Server 2012 R2, attendee Jakub M., shared a story as to how PowerShell reduced the amount of time it took him to prepare for disaster recover on behalf of his organization.  What originally took 3 days and 6 people to orchestrate was now reduced to PowerShell, coffee, his tablet and only two hours of his time.  Needless to say, the rest of the attendees were immediately interested in what PowerShell had to offer and were glued to Jakub's every word.  Jakub professed his PowerShell knowledge was only hobby based and was keen on increasing his knowledge.  During today's discussion around PowerShell, utilization of PowerShell History Viewer was made mention of as to how it could assist in further automating tasks amidst one's infrastructure. As you may know, Active Directory Domain Services in Windows Server 2012 currently utilizes 145 PowerShell cmdlets.  While learning all 145 might be daunting for some, utilizing PowerShell Shell History Viewer in Windows Server 2012 assists the learning process allowing administrators to take advantage of the cmdlets by copy and pasting cmdlets created through actions.  Since Jakub was kind enough to share with the attendees his tips in regards to PowerShell, we at CANITPRO are more that happy to share Utilizing PowerShell History Viewer in Windows Server 2012 via Step-By-Step with him and our audience.

The Windows Server 2012 Active Directory Administrative Center (ADAC) makes the process of viewing cmdlets history quite easy as it can be completed via a few simple steps.  In this example Windows PowerShell History Viewer will be utilized in ADAC to construct a Windows PowerShell script that will add users to a group.
 
Remember to complete this lab in your lab environment. Click here to learn how to create your own lab.
 

  1. Right click the Windows PowerShell icon, click Run as Administrator
     
  2. Open the Windows Server 2012 Active Directory Administrative Center
     

     
  3. Click Manage, click Add Navigation Nodes and select the appropriate target domain in the Add Navigation Nodes dialog box and then click OK.
     
  4. Expand the Windows PowerShell History pane at the bottom of the ADAC screen.
     
  5. Select a user. <Suggestion would be to create a new one to move if you have not done so already>
     
  6. Click Add to group… in the Tasks pane.
     
  7. Navigate to the desire group you wish to move the user to and click OK in the dialog box.
     
  8. Navigate to the Windows PowerShell History pane and locate the command just generated.
     

     
  9. Copy the command and paste it into your desired editor to construct your script.

This now allows an IT administrator to modify the command to be able to add a different user to a desired group without memorizing the required cmdlets. PowerShell can be a great time saver for any IT professional.  Be sure to also checkout Microsoft Virtual Academy has it offers a great PowerShell Jumpstart session which provides further insight in enabling IT professionals.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • This very interesting

  • @Jakub
    Well done! You've discovered the best feature of Windows PowerShell in that you don't actually need to know how to script just to use it!

    It get's even cooler when you find that PowerShell, vbscript and Console applications will ALL happily (and by design) interact and work with each other including passing and returning values and status codes!

    Welcome to the wonderful world .... of POWERSHELL! W0000T!

    Sean

  • Thank you Alicia. Let me know if there is anything else you'd like to see detailed.