PowerShell: Find all group policies as per the required string

0 comments
Sometimes it happens when you are asked to check all group policies which has a particular settings. There could be many reasons for the same, like need to change the setting globally, or remove the setting. When you start working on it, you see thousands of group policies to check and make the changes.

Making change in the policy is not time consuming but to find all policy on which you need to make this change is really complicated and too time consuming.

Being a powershell lover, i created a script which will help you to get the list of all GPOs as per your passed string and its status whether it is linked or not.


Fetch DNS scavenged records with help of powershell

1 comments
After enabling DNS Scavenging successfully in our infrastructure. It was huge pain to know what all DNS records have been scavenged. So, i wrote up a script to gather all information about scavenging and all scavenged records, then create a report for me and email me every Monday morning because Sunday is our scavenging day.

I am going to explain what all things will this script do for you and how can it be useful for your work.

Whenever DNS Scavenging happens, it generates two events, 2501 and 2502.
Event Id 2501 generates when DNS scavenging runs automatically. And the script which i created mainly uses 2501 event because DNS scavenging is configured to run automatically.
Event Id 2502 is same as 2501 and has all together information. But it generates when you run scavenging manually.

You will find both of these events under Event Viewer > Applications and Services Logs > DNS Server.

Domain Controller System State Backup (Server 2016)

0 comments
I recently schedule domain controller (PDC) system state backup to repeat the backup task every first Sunday of a month. I wrote up a script using new powershell windows backup commands. Commands are really good rather using old legacy command prompt utilities.

You can read the script from below attached screenshot. If you want to download it, you will find its link below the image.

Note: Make sure you install Windows backup feature first. Else these commands will not work.

Change DNS Dynamic Records to Static Records

0 comments
Most of the times happen that we got a request from other team and they ask to convert their servers DNS records from dynamic to static. It is fine to do this for 5-10 DNS records but what for 1000 records. I got the same request and i was scared to convert all 1000 records manually.

So i created a small script to do my work and want to share it if it can help you as well.

DHCP Security (Recommendations)

1 comments

I decided to write this article about DHCP security features which i recommend to all admins who are responsible for Domain Controllers, DHCP, DNS, NPS, PKI and etc. What i have observed in my career till so far that many administrators do not configure all DHCP security settings. Below i have mentioned some examples which i have experienced in my career.

1. We had a host record "WATCH" which was pointing to the IP address of a server. A user came with this home macbook and connected office LAN cable to its macbook. Our bad luck was, his macbook name was also "WATCH" and its IP address was replaced by the IP address of the Macbook.

2. We have a WiFi scope for visitors. So one day, someone came for an interview and connected his iPad to our Visitor Wifi. Suddenly our exchange team emailed me that their "SPAM" server logs have stopped working, please rectify it. When i checked, they used to have a DNS A record by the name of SPAM which was modified by a visitor Wifi IP Address. After check it more, we found that the visitor who came for an interview, his iPad name is SPAM. UUUfffffff..

3. In my first organisation, there was a problem of duplicate host records. And most of the teams like security, exchange and sccm were totally fucked up due to this issue. Issue was like, if you want to deploy something on system A it used to go on system D. If you need to run a script remotely on system D, it used to go on system G. Totally messed.

Here are the settings which i recommend for every admin.
A. Let DHCP owns DNS records.
B. Name Protection
C. Disable DNS record creation for some scopes.