Few of the articles are posted as Images, Please use Laptop / Computers to go through the articles for best experience. For phone users, switch to Web Version

Please Share with your colleagues if you found these blogs informative. Happy Learning :-)

Powershell Script - Comparing Policies sub folders with GP

  <#Created By - Abhishek Bansal

Read Me !!

Script Usage - This script will compare sub folder of Policies folder inside Sysvol for every DC with the Group Policy configured in GPMC

Once it compares, it will list all the Policy folders which are mapped to GPMC and show as "Valid GPO Folder" and Policy folder for any non existing Group Policy would be shows as "Not valid GPO folder .#>


$gpoid = Get-GPO -All

$dcs = (Get-ADDomainController -Filter *).Name

foreach($dc in $dcs)

{

    if($(Test-Path -Path "\\$dc\sysvol\Mari.com\Policies")-eq $true)

    {

    $Sysvolgpos = $(Get-ChildItem -Path "\\$dc\sysvol\Mari.com\Policies" -Exclude "*PolicyDefin*").Name

            $arr = @()   

                                foreach($Sysvolgpo in $Sysvolgpos)

                        {

                              foreach($gpo in $gpoid)

                                {

                                    $gpoingpmc = "{$($gpo.id)}"

                                    if($($gpoingpmc -eq $Sysvolgpo))

                                        {

                                        $arr += $gpoingpmc

                                        break

                                            }

                                   }

                }

        }

$Sysvolgpos | Where {$arr -Contains $_} | Select-Object -Property @{n="Domain Controller";e={$dc}},@{n="GPO Folder";e={$_}},@{n="Status";e={"Valid GPO folder"}}

$Sysvolgpos | Where {$arr -NotContains $_} | Select-Object -Property @{n="Domain Controller";e={$dc}},@{n="GPO Folder";e={$_}},@{n="Status";e={"Not valid GPO folder"}}

}


Sample Output












Fetching Event Logging Mode on Windows Servers

<#Created By Abhishek Bansal

Read Note 

Script Usage :: Want to check what logging mode is configured for events like System , Setup, Application , Security logs for all your servers ?? What' the current size of all the events contained in these logs ?? What's the maximum log size of these events ?? For all this, use below script.

Pre requisites :: Copy all the code into a text file, save it with an extension ".PS1". On same location create a text file named "InputServers.txt" which will be containing names of machines. Once saved, run script as Administrator.

Execution & Outputs :: Once executed Output will be saved in a file named "LoggingmodeOutput.csv" and any Errors into "Errorslogs.csv" onto same location. #>


$servers = Get-Content .\InputServers.txt

foreach($server in $servers)

{

$server = $server.trim()

$Error.Clear()

    try{

    Invoke-Command -ComputerName $server -ErrorAction Stop -ScriptBlock{Get-WinEvent -ListLog Application,Setup,System,Security | Select-Object @{n="Hostname";e={$using:server}},LogName,LastAccessTime,LastWriteTime,@{n="MaximumLogSize(MB)";e={[Math]::Round($($_.MaximumSizeInBytes)/1024/1024,1)}},@{n="CurrentEventSize(MB)";e={[Math]::Round($($_.FileSize)/1024/1024,1)}},@{n="Events Count";e={$_.RecordCount}},@{n="LoggingMode";e={$(if($_.Logmode -eq "Circular"){echo "Overwrite events as needed (Oldest events first)"}elseif($_.Logmode  -eq "Retain"){echo "Do not overwrite events (Clear logs manually)"}elseif($_.Logmode  -eq "AutoBackup"){echo "Archive the log when full, do not overwrite events)"})}},LogFilePath} | Export-Csv ./LoggingmodeOutput.csv -NoTypeInformation -Append

        }

    catch

    {

    $server | Select-Object @{n="Hostname";e={$server}},@{n="ErrorMessage";e={$($Error.Exception.Message)}} | Export-Csv ./Errorlogs.csv -NoTypeInformation -Append

    }

}


Sample Output 






























All Blogs Links By Category

Category

Links

Active Directory

Active Directory - (2148074274) The Target principal name is incorrect on Domain Controller while running Repadmin.

Active Directory

Active Directory - Controlling & Reducing Communication to PDC b/w Sites

Active Directory

Active Directory - Last Logon vs Last Logon Timestamp Attribute

Active Directory

Active Directory - Delegation of Control

Active Directory

Part 1 - Delegating rights to Manage Membership of an AD Group

Active Directory

Part 2 - Delegation of Control | Revoking Rights

Active Directory

Part 3 - Delegating access to Unlock User account in Active Directory

Active Directory

DNS - Backing up & Restoring AD Integrated Zone

Active Directory

Foreign Security Principals ? Identifying Stale FSP & cleaning them from AD

Active Directory

Active Directory - Updating DFS Referrals for the client

Active Directory

Active Directory - Difference in Selective & Forest Wide Authentication in AD Trust

Active Directory

Active Directory - Quick LAB - Resetting DSRM Password on a DC

Active Directory

Active Directory - Setting up Conditional Forwarder between domains in different forest

Active Directory

Active Directory - Setting up AD Trust between Domains

Active Directory

DHCP - Cleaning up Stale DHCP Server Records from Configuration Partition.

Active Directory

Delegating User rights to manage a specific DNS Zone

Active Directory

Active Directory - Editing ADDS Schema

Active Directory

Restoring Deleted User Object from AD Recycle Bin via Powershell

Active Directory

Enabling AD Recycle Bin throwing Error - A referral was returned from the server

Active Directory

Troubleshooting - DC Promotion Failing. Access is denied.

Active Directory

Active Directory - Disabling / Enabling Outbound or Inbound Replication on Domain Controllers

Active Directory

Active Directory - Disabling / Enabling Outbound or Inbound Replication on Domain Controllers

Active Directory

Non-Authoritative Synchronization for DFSR-replicated Sysvol

Active Directory

Moving FSMO Roles via Command line

Active Directory

Setting up Conditional Forwarders ?

Active Directory

Difference - DNS Conditional Forwarders & Forwarders ?

Active Directory

Lost and Found in Active Directory ?

Active Directory

Setting up Additional Domain Controller using IFM ( Install From Media)

Active Directory

Lingering Objects in Active Directory

Entra ID

How to Enable Pass Through Authentication and Testing its working with a Use case

Entra ID

Uninstalling Azure AD Connect Completely

Entra ID

Why highly Priviledged Onpremise Groups doesn't Sync to Entra ID ?

Entra ID

Entra ID - Unable to delete Security Group part of Administrative Unit Restricted Management

Entra ID

Syncing / Unsyncing OU's to Entra ID using Azure AD Sync Service Manager

Entra ID

Syncing Custom Attributes to Entra ID

Entra ID

Refreshing Directory Schema - Azure AD Connect

Entra ID

Domain Filtering from Azure AD Connect

Entra ID

Entra ID - Completed-export-errors while Syncing

Entra ID

Entra ID - Domain Filtering from Azure AD Connect

Entra ID

Blocking User to Use MFA - Entra ID

Entra ID

Troubleshooting Password Hash Sync Issue - Entra ID

Entra ID

Stop Syncing Onprem AD Users to Entra ID using Sync Rule Editor

Entra ID

Stopped-extension-DLL-exception / no-start-ma Error

Entra ID

Stopped-deletion-threshold-exceeded error while running Azure AD Sync

Entra ID

Syncing / Unsyncing an OU from Azure AD Connect

Group Policy

Group Policy Error - "The Permissions for this GPO in Sysvol folder are Inconsistent with those in Active Directory"

Group Policy

Group Policy - Processing of Multiple GPOs linked on Same OU

Group Policy

Group Policy Preferences - Apply once and do not reapply Setting

Group Policy

Group Policy - Domain Group Policy Overrides the Local Group Policy

Group Policy

Group Policy Preference Items - Stop Processing Items in this extension if an error occurs

Group Policy

Group Policy - Denying applying Policy for set of users.

Group Policy

Group Policy - Applying GPO only on DC holding PDC Emulator

Group Policy

Group Policy - Interactive logon: Display user information when the session is locked

Group Policy

Group Policy - Displaying a Custom Message before Server login

Group Policy

Group Policy - Accounts: Rename administrator account

Group Policy

Group Policy - Interactive log on: Prompt the user to change passwords before expiration

Group Policy

Group Policy - Security Concern in Security GPO

Group Policy

Fix - Software Installation via GPO Error code %%1274

Group Policy

GPO - The Interactive logon: Number of previous logons to cache (in case domain controller is not available)

Group Policy

Difference in Gpupdate vs Gpupdate Force

Group Policy

Powershell Script - Exporting GPO Settings in HTML

Group Policy

Powershell Script - Listing Empty GPOs

Powershell

Powershell Script - Comparing Policies sub folders with GP

Powershell

Fetching Event Logging Mode on Windows Servers

Powershell

Powershell Script - Disabling IPv6 on Windows Servers

Powershell

Powershell Script - Fetching AD Infra Details

Powershell

Powershell Script - Adding Bulk Users in an AD Group

Powershell

Powershell Script - Fetching User details from an Input file containing Email Id's of users - AD

Powershell

Powershell Script - Fetching User Membership from Active Directory

Powershell

Powershell Script - Fetching AD Computer Details

Powershell

Powershell Script - Fetching AD Computer Details

Powershell

Powershell Script - Identifying Disabled ID's in AD & Moving them in Disabled OU - Cleanup Project

Powershell

Powershell Script - Fetch membership of multiple AD Groups at once.

Powershell

Powershell Script - AD User Account & Password related details

Powershell

Powershell Script - New AD Groups Creation from .CSV File

Powershell

Powershell Script - Checking SMB1 Feature Status on Windows Servers

Powershell

Powershell Script - Windows Servers User Profile Status Check :: Cleanup Project

Powershell

Powershell Script - Exporting GPO Settings in HTML

Powershell

Powershell Script - Finding Group Membership differences b/w two ID's in AD

Powershell

Powershell Script - Removing Members (Users / Groups) from AD Group.

Powershell

Powershell Script - Fetching LAPS Password from AD

Powershell

Powershell Script - KB Installation Status on Windows Servers / Clients.

Powershell

Powershell Script - Listing Empty GPOs

Powershell

Powershell Script - Fetching AD Group Details

Powershell

Powershell Script - Fetching User details along with their Manager details from AD.

Powershell

Powershell Script - Export AD Group Membership containing large members

Powershell

Powershell Script - Creating New AD Groups

Powershell

Powershell Script - Remove Computer Objects from Active Directory

Vmware

Registering VM via Command Line

Vmware

Mounting Disk of One VM to Another VM

Vmware

Disk Modes - Dependent Vs Independent

Vmware

Fixing Remove Permission Failed Error from Esxi

Vmware

Difference in Template & Cloning

Windows

Fix - Error 2149842967 while installing cumulative security update on Windows Server

Windows

Windows Servers - Configuring Page File

Windows

Offline .Net Upgrade / Installation

Windows

RDS - Removing Invalid Collection from RD Web Access

Windows

Patch Installation via Command Line

Windows

Windows Admin Center - Part 1 Download & Installation

Windows

Windows Admin Center - Part 2 || Configuring WAC, Adding & Managing Servers

Windows

.Net 3.5 Installation Error. Source File not found

Windows

Logical Ports in Windows

Windows

Reliability Monitor

Windows

Resetting Windows Local Admin Password Using Utilman.exe Utility