Get list of Domain Controllers from your domain

Today I would like to show you how to prepare Domain Controllers report using Data Table. To get all DC’s we will use ActiveDirectory module. Basically you can get list of all Domain Controllers from your domain using just two commands: In this example I wanted to show you how to create Data Table and send results to your email in formatted HTML table. Script apart from gathering DC’s properties …

Configure VS Code to work with TFVC repository

For those who want to work with repositories I will show you today how to configure VS Code to work with TFVC repository. Let’s start! As a prerequisites you need to install following programs Visual Studio Code VS Code download Visual Studio (needed to have tf.exe file) Visual Studio download After successfull installation, go to extensions tab in Visual Studio Code and install Powershell and Visual Studio Team Service extensions …

PowerShell function – check failed ping status (Request timed out)

There was often situation where I had to ping some server for specific time. This is why I created Get-Ping function where you can specify for how many minutes server will be pinged. At the end you will have full results in pop-up window. In this function I just used simple ping command where I’ve searched lines with status names: One of function parameters is $Minutes. It will be used …

Remove stale DNS records

In today article I want to show you script which how in automatic way remove stale DNS records. In big environments there is often situation that DNS contains stale records which are causing mess. Script which I prepared is scanning dns zone defined at the beginning for records which timestamp is older than specific number of days (NumberOfDaysBack variable). Once all are gathered, script remove stale DNS records. Script: NOTE: …

How to convert Azure VM to use managed disks

Did you ever hear about Azure managed disks? Do you know how to convert Azure VM to use managed disks? If for both question your answer is no, let me help you to explain what managed disks are and for which purpose they are use. Managed disks are new type of storage which is recommended to be used by Azure Virtual Machines. Managed Disks offer two types of storage options: …

Check secure channel on multiple servers

Checking secure channel on all machines might be time consuming, especially in large scale environments. Today I will show you how to get that information easily using PowerShell function and additionally check IP addresses. To get information about secure channel I used the following nltest command: Usage: You can display results in console, pop-up window or save it to CSV file: Final script: Check how to test connection on several …

Check weather using public API

In this article I want to show you how to use API for getting weather information. In this example I used metaweather API where additional authentication is not required. First we need to understand a little bit what REST API is. REST API – compliant Web services allow requesting systems to access and manipulate textual representations of Web resources using a uniform and predefined set of stateless operations. In simple …

Remove wrong PTR records from your DNS

Recently I wanted to remove wrong PTR records in one of the customer production environment. After quick analysis I observed that it is not so easy easy to do manually, so decided to write Powershell script. What script is doing? Script gahters all PTR records from Reverse lookup zone provided in $ZoneName variable. In next step it convert PTR record to standard IP format and checks if hostname record assigned …

Find files larger than given size using PowerShell

In this article I will show you how to find files on your PC. Function posted below will help you to scan selected path for files larger than specified size. I used windows forms to select path for scanning in browse window: To scan some path you can use just this simple Get-ChildItem command: Script will return the following parameters: – Name – Extension – Fullname – CreationTime – LastAccessTime …

Protect resources from accidental deletion

Today I want to share with you my script which will help protect resources from accidental deletion. In first way script is gathering all domains in Active Directory forest. Next OU and DNS zone objects which are unprotected are pulled out. Final step is setting flag ProtectedFromAccidentalDeletioin for those objects to $True. And this is how you should protect resources from accidental deletion. 🙂 Script: As script is scanning all …