PowerShell - Finding Domain Controllers
If your computer is logged on to an Active Directory, here is some code to get to your domain controllers.
Research and Development
If your computer is logged on to an Active Directory, here is some code to get to your domain controllers.
In traditional batch files, you can use && to execute a second command only if the first one worked. In PowerShell, the same can be achieved by using the try/catch construct.
Parsing a date and/or time information is tricky because formatting depends on the regional settings. This is why PowerShell can convert date and time based on your regional settings or in a culture-neutral format.
Compare-Object is one of the most widely ignored most powerful cmdlet around. It can compare results and figure out differences.
Here is a powershell function that creates a local folder and also shares it so others can use it via network.
Here's a small function that first checks to see that the URL you are mapping to does not yet exist, avoiding duplicate mapped drives.
When you want to catch errors produced by cmdlets, always make sure you add the parameter -ErrorAction Stop to it.
Ever wanted to read out the Windows license key? In the Windows Registry, this key is present, but it is stored as a digital ID.
If you want to know whether your script has currently full Administrator privileges, here is an one-liner that tells you.
By default, all variables created in functions are local, so they only exist within that function and all functions that are called from within this function.