Log lines

Extract IP address from log lines using PowerShell

Recently I had to extract IP Addresses from log file and check their hostnames. The easiest way to get this was using regex pattern in Select-String command. Extract IP Address Lets says that we have a log file which contains lines like: AUDIT “2018-06-19 00:14:16.481 GMT+0200” 10.13.11.7 Server01:1812 0 0 “text=Access GRANTED cloudId=pawel.janowicz To extract IP Address from it we can use Select-String command with the following regex pattern “\d{1,3}(\.\d{1,3}){3}”>: …

Setup Azure VPN using PowerShell

Hey Scripters! Today I want to share with you my script for setup Azure VPN using PowerShell. In few words, script is using basic Azure module command. At the begginig you should have your VPN device already configured and once it is done, you can start configuration from Azure site. To configure VPN device you should already have public IP created in Azure. All variables depends on your on premise …

Update Rollup

Get SCOM update rollup version remotely

Checking SCOM update rollup version using console is pretty simple. Things are getting a little bit complicated if we want to get this from server. Using WMI or PowerShell commands like Get-Hotfix probably we will not get this information. Update Rollup To check this locally we have to get FileVersion for OMAgentTraceTMFVer.Dll file. Each version is assosiated with one of the Update Rollups. For more information you can visit System …

Shadow Copy

PowerShell one-liner: Shadow Copy Backup date

This short article is about getting last Active Directory Shadow Copy Backup date. To check this we just have to scan event log for specific event id. AD Backup Information about Shadow Copy Backup is located in logname called ‘Directory Service’ and event id ‘1917’: “The shadow copy backup for Active Directory Domain Services was successful.” One of the command that we could use here is Get-WinEvent where we can …

Test URL on Server Core machines using PowerShell

Recently I had to test URL on server core machines. I created simple scripts to generate report with just basic information like status code and content. Below you can find short description how to check http and https URLs. Test URL For checking http URL I used Invoke-WebRequest command. Unfortunately when I run it localy on server core machine it returned me an error: Error message: The response content cannot …

Copy managed disks between Azure subscriptions using PowerShell

Hey Folks! In todays article I want to show you how to copy managed disks between Azure subscriptions using PowerShell. Script is very easy in use. The only things which you should provide are variables on the beginning like subscription ids, resource groups etc. As a result .vhd file will be created under destination container on storage account. Remember that Azure account under which script for copy managed disks between …

Get domain role and PC type from remote computers

Today I want to show how to get domain role and PC type using PowerShell function. You can get this information easily using 1 liner script but results will be presented as numbers. Domain role and PC type Function is based on Get-WmiObject command and it query Win32_computersystem class. To get “PC type” and “Domain Role” using just one command we have to use Select-Object cmdlet after the pipeline: Unfortunelty …

ADFS_product_version

Get ADFS product version using PowerShell

In this short arcticle you’re gonna find out how to check ADFS product version on multiple remote servers. Recently I had to scan my environment for auditing purpose. One of the tasks was to compare ADFS service product version. ADFS product version To check it on single machine we can use Get-Item cmdlet: It getting a little bit more complicated if you have plenty of severs and they are Server …

PowerShell Tip of the Week: Create Invoke-WebRequest from Chrome

This week PowerShell tip will show you how to create Invoke-WebRequest from Chrome. Each scripter who wanted to properly use Invoke-WebRequest command to access some url knows that it is not so easy. Every time headers or some additional settings must be adjusted to properly gather all the data. Last update of Chrome web browser gives awesome functionality for PowerShell developers. In Chrome Dev Tools option to copy whole Invoke-WebRequest …

Get Azure Webjobs failed runs using PowerShell

Todays article will show you how to get Azure webjobs failed runs using PowerShell. Recently I was asked to prepare monitoring for Azure webjobs. I thought it will be quite simple and Application Insights can be used for this purpose. Unfortunetly to use Application Insights for this purpose additional development (telemetry implementation inside code) is needed. How script work? To get Azure webjobs failed runs script is connectig via API …