PowerShell for Admins

PowerShell for Admins
Steve Parankewich
PowerShell for Admins

Join Computer to Domain with Specified Computer Name and OU

I addressed a reader requested script for my article this week. PowerShell gives you the ability to add computers to Active Directory right from the command line with the built in PowerShell commandlets. This was introduced with PowerShell version 3 and can be used to automate imaging processes or to prompt an agent for the desired computer name and organizational unit. This is useful since a lot of organizations will use specific OUs for computers according to location or department.

Steve Parankewich
PowerShell for Admins

Find any E-Mail Address or Proxy Address In Active Directory

I am back this week with some more Exchange and Unified Communications goodness. This is another request I see a lot, someone want’s to know where an e-mail address is assigned. This opens up the possibilities of user mailboxes, shared mailboxes, distribution lists, public folders, conference rooms, contacts or resources. I have also seen duplicate e-mail addresses being assigned outside of Exchange causing delivery failures. I take a look at how you can quickly find any e-mail address in your environment along with partial searches of e-mail addresses.

nohwnd
PowerShell for Admins

Command and query separation in Pester tests

Do you feel that writing tests is confusing, and you often end up with complicated test code? I did too, before I learned about Command-query separation principle (or CQS). This principle lead me to start thinking about data flow directions in tests and in the end I realized there are few basic patterns that I use in my test code over and over. Command-query separation principle The command and query separation principle tells us that we should separate commands from queries (duh!

Will Anderson
PowerShell for Admins

Desired State Configuration – Beware Of Circular Configurations

Lately, I’ve been working at converting a lot of my server configuration scripts into DSC configurations. After all, what better way to learn than by updating your existing methods? I recently ran into an issue, however, while converting my SCCM Distribution Point deployment script into a config, where the test systems inexplicably began rebooting every thirty minutes or so. The Local Configuration Manager was configured to reboot if necessary, and these were fresh installs, so I knew that my culprit was most likely in my configuration.

Timothy Warner
PowerShell for Admins

Using Package Management in Windows PowerShell v3

Hey now! The PowerShell team published a preview version of PackageManagement for Windows PowerShell v3 and v4. As it happens, I have a Windows 7 SP1 box running PowerShell v3–why not run a little experiment? `$PSVersionTable.PSVersion Major Minor Build Revision 3 0 -1 -1 `## Preparing the Environment You need .NET Framework 4.5 or later, so take care of that prerequisite before you install the following two assets: Windows Management Framework (WMF) v3 PackageManagement PowerShell Modules Preview I restarted the computer after each installation just to be safe.

Steve Parankewich
PowerShell for Admins

Automate Sip Address and UPN name changes in Lync / Skype for Business

Name changes are a common occurrence in the world of IT and usually the primary concern is the e-mail address. Exchange e-mail address policies will handle this for us but often times the Sip Address and User Principal Name are left behind. I tackle these changes with an automated way of changing the Lync / Skype for Business sip address (also known as sign-in address) and User Principal Name to match the e-mail address.

Steve Parankewich
PowerShell for Admins

Export Subnets from Active Directory Sites and Services

I am back this week with a quick write up on how to export your network subnets from Active Directory Sites and Services. Active Directory Sites and Services subnet assignments are important for healthy replication and for location based services to function properly. The need for this information has come across my desk on several occasions. Even a quick print out would be extremely helpful to keep at your desk. I have included both Windows 7/2008 and Windows 8/2012 methods to ensure everyone is covered.

Timothy Warner
PowerShell for Admins

Testing PowerShell Direct with Windows Server 2016 TP3 Hyper-V

Hey there! I thought we could test PowerShell Direct together today. Here’s the elevator pitch: In Windows Server 2016 and Windows 10, we can send PowerShell commands from the Hyper-V host directly to its corresponding virtual machines (VMs), even in the absence of guest VM networking. Yeah, that’s cool, isn’t it? What’s just as impressive is that PowerShell Direct works _even if PowerShell remoting is disabled on the guest VM! _PowerShell Direct also circumvents Windows Firewall.

pscookiemonster
PowerShell for Admins

Finding Evil LDAP Queries

Have you ever wondered what LDAP queries were hitting your domain controllers? Even outside of fun investigations, it can be insightful to get a sampling of queries hitting your domain controller. The more services you have integrated with Active Directory, the more likely a vendor or sysadmin unwittingly configured their service to produce evil queries. Mark Morowczynski from Microsoft wrote a great post on finding these expensive, inefficient, or long running queries - But something was missing.

Steve Parankewich
PowerShell for Admins

Delete Specific E-Mail or E-Mails From All Exchange Mailboxes

Well this is week number two in my quest to post an article once a week and I am back with a common request for Exchange administrators. There are a lot of scenarios that bring up a need to remove an e-mail or e-mails from all mailboxes in your environment. Perhaps there was a disgruntled employee, a virus outbreak, or a reply all to the whole company. We all know that the “Retract” button is best effort (yes I still miss GroupWise for that purpose).