Good Contents Are Everywhere, But Here, We Deliver The Best of The Best.Please Hold on!
Data is Loading...
Your address will show here +12 34 56 78
PowerShell, Server, Windows
You can do everything with PowerShell, yes as well locking your workstation with one simple function call. The function uses the API by importing the user32.dll and is being invoked to lock the workstation. Thanks to Mike Pfeiffer from TechNet for this simple but useful script. The fine thing is, it works on a local or remote session.



Azure, Cloud, PowerShell
If you need a script which outputs you the overall VMCore amount per region, there you go.
This is a snippet from a RunBook which iterates also through each subscription before, so you would get all amount of used cores per subscription as well as per region.

I took the advantage of using Get-AzureRmVMUsage.
So you can use this two-liner



or a tiny script like this which gives you the result per region


which gives you this


PowerShell, Server, Windows
As published in my Technet Gallery Script Center here, you can get current timezones remotely via PowerShell with Get-Timezones. Get-Timezones is using WMI to communicate with your servers.

This will give you following output:

With Set-Timezone you can set timezones remotely. If you need to disable automatic daylight saving time you can add the additional parameter DSTOff.

This will give you following output:

To get a full list of all timezone IDs type “tzutil /l” and you will get following list:



Hotfix, Patching, PowerShell, Server, Windows
I just wanted to share you a tiny snippet if you’re looking for a simple PowerShell liner to simply get a KB Hotfix installed. It also verifies if the KB is installed already.
Okay this is a small one for you guys but trust me I will wrap it for you into a big function if you want to use it with more than one server or even Credentials.



PowerShell, Server, Windows
Every System Administrator comes into a situation where you want to see who and how many users were logged on to your servers either via Remote Desktop or via script. This little function evaluates the System log with the help of Get-EventLog and delivers you the latest logon and logoff events for every user. 

I’ve left you the Invoke-Command commented if you want to use PowerShell Remoting (WinRM).

Please keep in mind, it evaluates every event, this means even if a user was doing actions remotely using a powershell script or just logged on, it will be displayed as well. If you want to distinguish between script logons you can easily have a look at the logon and logoff times. If a user account was only logged for some seconds … then this is an indicator for a remote script logon.

The script will give you following output:

While using following command you can also query this function to more than just one server:




PowerShell, Server, Windows
Have you ever wondered if there’s an opportunity to easily create a GUI out of every PowerShell Cmdlet?
In many cases this can be very useful for example if your Cmdlet hs too many parameters to list or just to see what’s it offering on Common parameters as well.

Just use the Show-Command cmdlet with any PowerShell cmdlet to bring up a GUI interface.
Let’s try this with the Get-Service Cmdlet and see what’s happening!

You will have three options for executing your command: Run, Copy (for the clipboard), or Cancel.


Network, PowerShell, Server, Windows
In this case we’re going to use the method GetHostAddresses of the Dns class of the Sytem.Net namespace.
For PowerShell 2.0 you can use following Windows PowerShell One Liners:

Name to IP Address (DNS Forward)

IP Address to Name (DNS Reverse)

As of PowerShell 3.0 you can use the method GetHostEntry() for both Forward and Reverse: As of PowerShell 4.0 you can use the Cmdlet Resolve-DnsName as well as for both Forward and Reverse: