PowerShell Tip of the Week: Restart Web Application remotely

In todays short article I want to share few simple one-liner scripts that I’m using for Web Applications. They might be useful for your daily administration and if you want to create automated reports. Web Application pool I often need to check application pools status and depends on the output perform some actions. To use examples from this article you need WebAdministration module commands. Below you can find how to …

events

Extract dates from string and convert it to UTC

Today I want to show you how to extract dates from string. Recently I posted article about getting IP address from log file. This time its a little bit more compliacted as date format in string is invalid. Extract date from string Extracting dates from string is pretty simple if you know the regex pattern. In my case I had to get all dates from string and use it as …

lockout source

Get lockout source for currently locked users

Todays articile is about getting lockout source and checking who is currently locked in your environment. Script is based on ActiveDirectory module and Get-WinEvent commands. Currently locked users First we need to check how many users are locked. Below you can find simple script for checking that. Script is using Search-ADAccount command with LockedOut parameter. Find lockout source Next part is to find lockout source for each users. To do …

Add Azure Function key using PowerShell

In today’s article I want to show you how to add Azure Function key using PowerShell. Azure Function keys allows to authorize and authenticate at the level of the entire application or a single function using keys. In my script I’ve added only option to set same key for all of the functions in application. All input parameters are mandatory, so remember to fill them all. Script: If you will …

SCOM UR

Installing SCOM UR patch on remote computers

In this short articile you will find out how to install SCOM UR patch remotely. In one of the previous articile you can check also how to get information about UR version from remote machines. Installing SCOM UR Below you can find simple example for installing patch 2012 R2 UR14: In my case patch with .msp extension was located on d: drive: First script will create folder d:\temp on remote …

SCOM

End SCOM maintenance mode on multiple servers

Today I would like to share with you a one of SCOM scripts which I use on regular basis. Some of you are working in large scale environment and have to put large amount of servers in SCOM maintenance mode. In this article you will find out how to stop it for some specific machines. End SCOM maintenance mode In one of the previous articles I was describing how to …

Check Azure VPN connection health

Hi Scripters! Today I want to show you how to check Azure VPN connection health using PowerShell. In my last post I showed you how to Setup Azure VPN. We will continue last topic about VPN but from monitoring perspective. It’s important to monitor Azure resources, specially if we connect Azure with On-premise environemnt. By default there is not standard monitoring solution which can help us to diagnose connectivty issue. …

remove

Remove user from specific AD groups using PowerShell

If you are looking for simple AD group member removal script this article is for you. Today I want to share few examples about getting group membership and removing one specific user from multiple groups. I was using commands form ActiveDirectory module. Get user group membership Below you can find several commands which helps to get user direct group mmebership: Remove user group membership Removing user from specific group is …

Get-Process

Get process remotely including username using PowerShell

In today’s article I would like to describe how to get process remotelty used by some specific username. Most of PowerShell admins are familiar with this command but no all knows its paramter called IncludeUserName. Recently I had to check processes under some username on bunch of servers. Below you can find few helpful examples. Get process locally Get all processes for some specific user is not difficult. Paramter -IncludeUserName …

group

Add users to local group remotely using PowerShell

How to add users to local group on remote servers? The easiest way for me was to create simple PowerShell script 🙂 Some time ago we posted article about adding group – link. In this article I want to show you how to add mutliple users to some specific group. Get Members First you should know how to verify who is currently added to group. To get members from remote …