Team Ai
Apppublic

aravind32/adexplained-your-directory-decoder

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
powershell.html284 linesDownload Raw Back to root
1```html2<!DOCTYPE html>3<html lang="en" class="undefined">4<head>5    <meta charset="UTF-8">6    <meta name="viewport" content="width=device-width, initial-scale=1.0">7    <title>ADExplained | PowerShell Guide</title>8    <script src="https://cdn.tailwindcss.com"></script>9    <script src="https://unpkg.com/feather-icons"></script>10    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>11    <script>12        tailwind.config = {13            theme: {14                extend: {15                    colors: {16                        primary: '#3b82f6',17                        secondary: '#60a5fa',18                        dark: '#1e293b',19                        light: '#f8fafc'20                    }21                }22            }23        }24    </script>25    <style>26        .hero-gradient {27            background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);28        }29        .command-card {30            transition: all 0.3s ease;31        }32        .command-card:hover {33            transform: translateY(-3px);34            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);35        }36        .nav-link:hover {37            color: #3b82f6;38        }39        pre {40            background-color: #1e293b;41            color: #f8fafc;42            padding: 1rem;43            border-radius: 0.375rem;44            overflow-x: auto;45        }46        code {47            color: #60a5fa;48        }49    </style>50</head>51<body class="bg-gray-50 text-gray-800 font-sans antialiased">52    <!-- Navigation -->53    <nav class="bg-white shadow-sm sticky top-0 z-50">54        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">55            <div class="flex justify-between h-16">56                <div class="flex items-center">57                    <div class="flex-shrink-0 flex items-center">58                        <i data-feather="layers" class="text-primary h-8 w-8"></i>59                        <span class="ml-2 text-xl font-bold text-gray-900">ADExplained</span>60                    </div>61                </div>62                <div class="hidden md:ml-6 md:flex md:space-x-8">63                    <a href="index.html" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">Home</a>64                    <a href="index.html#concepts" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">Core Concepts</a>65                    <a href="index.html#management" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">User Management</a>66                    <a href="index.html#security" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">Security</a>67                    <a href="index.html#best-practices" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">Best Practices</a>68                    <a href="index.html#faq" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">FAQ</a>69                    <a href="powershell.html" class="nav-link border-primary text-primary px-3 py-2 text-sm font-medium">PowerShell Guide</a>70                    <a href="adgame.html" class="nav-link border-transparent text-gray-500 hover:text-gray-700 px-3 py-2 text-sm font-medium">AD Game</a>71</div>72                <div class="-mr-2 flex items-center md:hidden">73                    <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-primary">74                        <i data-feather="menu"></i>75                    </button>76                </div>77            </div>78        </div>79    </nav>80 81    <!-- Hero Section -->82    <div class="hero-gradient text-white">83        <div class="max-w-7xl mx-auto py-24 px-4 sm:py-32 sm:px-6 lg:px-8">84            <div class="text-center">85                <h1 class="text-4xl font-extrabold tracking-tight sm:text-5xl lg:text-6xl">86                    Active Directory PowerShell Guide87                </h1>88                <p class="mt-6 max-w-3xl mx-auto text-xl">89                    Comprehensive collection of PowerShell commands for managing and troubleshooting Active Directory.90                </p>91            </div>92        </div>93    </div>94 95    <!-- Main Content -->96    <div class="py-12 bg-white">97        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">98            <div class="lg:text-center mb-12">99                <h2 class="text-base text-primary font-semibold tracking-wide uppercase">PowerShell Commands</h2>100                <p class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl">101                    Essential AD PowerShell Cmdlets102                </p>103                <p class="mt-4 max-w-2xl text-xl text-gray-500 lg:mx-auto">104                    These commands will help you manage users, groups, computers, and other AD objects efficiently.105                </p>106            </div>107 108            <!-- User Management Section -->109            <div class="mb-16">110                <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">111                    <i data-feather="users" class="text-primary mr-3"></i> User Management112                </h3>113                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">114                    <!-- Create User -->115                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">116                        <h4 class="font-bold text-lg text-gray-800 mb-3">Create New User</h4>117                        <pre><code>New-ADUser -Name "John Doe" `118    -GivenName "John" `119    -Surname "Doe" `120    -SamAccountName "jdoe" `121    -UserPrincipalName "jdoe@domain.com" `122    -Path "OU=Users,DC=domain,DC=com" `123    -AccountPassword (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force) `124    -Enabled $true</code></pre>125                        <p class="mt-3 text-sm text-gray-600">Creates a new user account with specified attributes.</p>126                    </div>127 128                    <!-- Get User -->129                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">130                        <h4 class="font-bold text-lg text-gray-800 mb-3">Get User Information</h4>131                        <pre><code>Get-ADUser -Identity jdoe `132    -Properties *</code></pre>133                        <p class="mt-3 text-sm text-gray-600">Retrieves all properties for a specific user.</p>134                    </div>135 136                    <!-- Modify User -->137                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">138                        <h4 class="font-bold text-lg text-gray-800 mb-3">Modify User Attributes</h4>139                        <pre><code>Set-ADUser -Identity jdoe `140    -Department "IT" `141    -Title "System Administrator" `142    -Office "Headquarters" `143    -EmailAddress "jdoe@company.com"</code></pre>144                        <p class="mt-3 text-sm text-gray-600">Updates multiple attributes for a user account.</p>145                    </div>146 147                    <!-- Disable User -->148                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">149                        <h4 class="font-bold text-lg text-gray-800 mb-3">Disable User Account</h4>150                        <pre><code>Disable-ADAccount -Identity jdoe</code></pre>151                        <p class="mt-3 text-sm text-gray-600">Disables a user account while preserving all attributes.</p>152                    </div>153 154                    <!-- Unlock User -->155                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">156                        <h4 class="font-bold text-lg text-gray-800 mb-3">Unlock User Account</h4>157                        <pre><code>Unlock-ADAccount -Identity jdoe</code></pre>158                        <p class="mt-3 text-sm text-gray-600">Unlocks a user account that was locked due to failed logon attempts.</p>159                    </div>160 161                    <!-- Reset Password -->162                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">163                        <h4 class="font-bold text-lg text-gray-800 mb-3">Reset User Password</h4>164                        <pre><code>Set-ADAccountPassword -Identity jdoe `165    -Reset `166    -NewPassword (ConvertTo-SecureString "NewP@ssw0rd" -AsPlainText -Force)</code></pre>167                        <p class="mt-3 text-sm text-gray-600">Resets a user's password (requires admin privileges).</p>168                    </div>169                </div>170            </div>171 172            <!-- Group Management Section -->173            <div class="mb-16">174                <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">175                    <i data-feather="users" class="text-primary mr-3"></i> Group Management176                </h3>177                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">178                    <!-- Create Group -->179                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">180                        <h4 class="font-bold text-lg text-gray-800 mb-3">Create New Group</h4>181                        <pre><code>New-ADGroup -Name "IT Admins" `182    -SamAccountName "ITAdmins" `183    -GroupCategory Security `184    -GroupScope Global `185    -Path "OU=Groups,DC=domain,DC=com"</code></pre>186                        <p class="mt-3 text-sm text-gray-600">Creates a new security group with global scope.</p>187                    </div>188 189                    <!-- Add Member -->190                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">191                        <h4 class="font-bold text-lg text-gray-800 mb-3">Add User to Group</h4>192                        <pre><code>Add-ADGroupMember -Identity "ITAdmins" `193    -Members jdoe</code></pre>194                        <p class="mt-3 text-sm text-gray-600">Adds a user to an existing group.</p>195                    </div>196 197                    <!-- Get Group Members -->198                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">199                        <h4 class="font-bold text-lg text-gray-800 mb-3">List Group Members</h4>200                        <pre><code>Get-ADGroupMember -Identity "ITAdmins"</code></pre>201                        <p class="mt-3 text-sm text-gray-600">Lists all members of a specific group.</p>202                    </div>203 204                    <!-- Remove Member -->205                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">206                        <h4 class="font-bold text-lg text-gray-800 mb-3">Remove User from Group</h4>207                        <pre><code>Remove-ADGroupMember -Identity "ITAdmins" `208    -Members jdoe `209    -Confirm:$false</code></pre>210                        <p class="mt-3 text-sm text-gray-600">Removes a user from a group without confirmation.</p>211                    </div>212 213                    <!-- Get User Groups -->214                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">215                        <h4 class="font-bold text-lg text-gray-800 mb-3">Get User's Group Memberships</h4>216                        <pre><code>Get-ADPrincipalGroupMembership -Identity jdoe</code></pre>217                        <p class="mt-3 text-sm text-gray-600">Lists all groups a user is member of.</p>218                    </div>219 220                    <!-- Delete Group -->221                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">222                        <h4 class="font-bold text-lg text-gray-800 mb-3">Delete Group</h4>223                        <pre><code>Remove-ADGroup -Identity "ITAdmins" `224    -Confirm:$false</code></pre>225                        <p class="mt-3 text-sm text-gray-600">Deletes a group without confirmation.</p>226                    </div>227                </div>228            </div>229 230            <!-- Computer Management Section -->231            <div class="mb-16">232                <h3 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">233                    <i data-feather="monitor" class="text-primary mr-3"></i> Computer Management234                </h3>235                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">236                    <!-- Create Computer -->237                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">238                        <h4 class="font-bold text-lg text-gray-800 mb-3">Create Computer Account</h4>239                        <pre><code>New-ADComputer -Name "WS001" `240    -SamAccountName "WS001$" `241    -Path "OU=Workstations,DC=domain,DC=com"</code></pre>242                        <p class="mt-3 text-sm text-gray-600">Creates a new computer account in Active Directory.</p>243                    </div>244 245                    <!-- Get Computer -->246                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">247                        <h4 class="font-bold text-lg text-gray-800 mb-3">Get Computer Information</h4>248                        <pre><code>Get-ADComputer -Identity WS001 `249    -Properties *</code></pre>250                        <p class="mt-3 text-sm text-gray-600">Retrieves all properties for a computer account.</p>251                    </div>252 253                    <!-- Disable Computer -->254                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">255                        <h4 class="font-bold text-lg text-gray-800 mb-3">Disable Computer Account</h4>256                        <pre><code>Disable-ADAccount -Identity "WS001$"</code></pre>257                        <p class="mt-3 text-sm text-gray-600">Disables a computer account in AD.</p>258                    </div>259 260                    <!-- Move Computer -->261                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">262                        <h4 class="font-bold text-lg text-gray-800 mb-3">Move Computer to Different OU</h4>263                        <pre><code>Get-ADComputer -Identity WS001 | 264    Move-ADObject -TargetPath "OU=Disabled,DC=domain,DC=com"</code></pre>265                        <p class="mt-3 text-sm text-gray-600">Moves a computer account to a different organizational unit.</p>266                    </div>267 268                    <!-- Find Inactive Computers -->269                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">270                        <h4 class="font-bold text-lg text-gray-800 mb-3">Find Inactive Computers</h4>271                        <pre><code>$daysInactive = 90272$time = (Get-Date).AddDays(-$daysInactive)273Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} `274    -Properties LastLogonTimeStamp |275    Select-Object Name,@{Name="LastLogon";Expression={[datetime]::FromFileTime($_.LastLogonTimeStamp)}}</code></pre>276                        <p class="mt-3 text-sm text-gray-600">Finds computers that haven't logged on in specified days.</p>277                    </div>278 279                    <!-- Delete Computer -->280                    <div class="command-card bg-gray-50 p-6 rounded-lg shadow">281                        <h4 class="font-bold text-lg text-gray-800 mb-3">Delete Computer Account</h4>282                        <pre><code>Remove-ADComputer -Identity WS001 `283    -Confirm:$false</code></pre>284                        <p class="mt-3 text-sm text-gray-600">Deletes a computer account from AD.</p>