Rajesh Alda

PowerShell Bulk Active Directory User Creation Script for 5 Million Users Across 10 Organizational Units
  • 38
  • 0
Code:
# Import the Active Directory module if it's not already loaded
Import-Module ActiveDirectory

# Generate 10 random Organizational Units (OUs)
$ouNames = @('Finance', 'HR', 'IT', 'Sales', 'Marketing', 'Operations', 'Admin', 'Support', 'R&D', 'Logistics')
$ouList = @()

# Root DN (Distinguished Name) to create OUs under
$rootDN = "DC=rajeshalda,DC=local"

# Create the OUs
foreach ($ouName in $ouNames) {
    $ouPath = "OU=$ouName,$rootDN"
    $ouList += $ouPath

    # Check if the OU already exists, if not create it
    if (-not (Get-ADOrganizationalUnit -Filter "DistinguishedName -eq '$ouPath'")) {
        New-ADOrganizationalUnit -Name $ouName -Path $rootDN
        Write-Output "Created Organizational Unit: $ouPath"
    } else {
        Write-Output "OU already exists: $ouPath"
    }
}

# Total number of users to create
$totalUsers = 5000000
# Users per OU (since 10 OUs)
$usersPerOU = 500000

# Loop through OUs and add users
for ($i = 0; $i -lt 10; $i++) {
    $ou =...
PowerShell Automated DC Setup with IP and Name Configuration
  • 28
  • 0
Code:
# First part of the script: Rename the computer and configure the network
# Specify the new computer name
$newComputerName = "DC-1"

# Rename the computer
Rename-Computer -NewName $newComputerName -Force -PassThru

# Restart the computer to apply the new name
Restart-Computer -Force

# Define the network adapter name (e.g., Ethernet)
$adapterName = "Ethernet"

# Define the static IP address, subnet prefix, and DNS settings
$ipAddress = "192.168.2.1"
$subnetPrefix = "24"           # This is for a subnet mask of 255.255.255.0
$dnsServer = "192.168.2.1"      # Add DNS server

# Add the IP address to the network adapter without a gateway
New-NetIPAddress -InterfaceAlias $adapterName -IPAddress $ipAddress -PrefixLength $subnetPrefix

# Configure the DNS server on the network adapter
Set-DnsClientServerAddress -InterfaceAlias $adapterName -ServerAddresses $dnsServer

# Path to the second part of the script that will run after the restart
$secondPartScriptPath =...
PowerShell AZURE-AD-CONNECT-ISSUSE-SCRIPT-RESOLVER
  • 15
  • 0
Code:
If (-Not (Test-Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319'))
{
    New-Item 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319' -Name 'SystemDefaultTlsVersions' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -PropertyType 'DWord' -Force | Out-Null

If (-Not (Test-Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319'))
{
    New-Item 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Name 'SystemDefaultTlsVersions' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -PropertyType 'DWord' -Force |...
PowerShell To add IP Address & Gateway & Dns
  • 24
  • 0
Code:
# Define the network adapter name (e.g., Ethernet)
$adapterName = "Ethernet"

# Define the static IP address, subnet prefix, and default gateway
$ipAddress = "192.168.2.1"
$subnetPrefix = "24" # This is for a subnet mask of 255.255.255.0
$gateway = "192.168.2.254" # Replace this with your network's gateway IP address

# Add the IP address to the network adapter
New-NetIPAddress -InterfaceAlias $adapterName -IPAddress $ipAddress -PrefixLength $subnetPrefix -DefaultGateway $gateway

# Define the DNS server (optional)
$dnsServer = "8.8.8.8" # Google's DNS server, replace if needed

# Set the DNS server for the network adapter
Set-DnsClientServerAddress -InterfaceAlias $adapterName -ServerAddresses $dnsServer
PowerShell To Change IP Address in Ethernet
  • 20
  • 0
Code:
#this script doesnt do for gateway

# Define the network adapter name (e.g., Ethernet)
$adapterName = "Ethernet"

# Define the static IP address, subnet prefix, and DNS settings
$ipAddress = "192.168.2.1"
$subnetPrefix = "24"           # This is for a subnet mask of 255.255.255.0
$dnsServer = "192.168.2.1"      # Add DNS server

# Add the IP address to the network adapter without a gateway
New-NetIPAddress -InterfaceAlias $adapterName -IPAddress $ipAddress -PrefixLength $subnetPrefix

# Configure the DNS server on the network adapter
Set-DnsClientServerAddress -InterfaceAlias $adapterName -ServerAddresses $dnsServer
PowerShell To Change Computer Name
  • 27
  • 0
Code:
# Specify the new computer name
$newComputerName = "DC-1"

# Rename the computer
Rename-Computer -NewName $newComputerName -Force -PassThru

# Restart the computer to apply the new name
Restart-Computer -Force
PowerShell Adding Existing Domain Controller
  • 28
  • 0
Code:
#if eeror arrive must if you have added the DNS of Primary Domain or not ?

# Install the AD DS role and management tools

Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

# Define the existing domain name

$domainName = "yourdomain.com"  # Replace with your existing domain name

# Prompt for domain admin credentials first

$domainAdminCreds = Get-Credential

# Prompt for the DSRM password (Directory Services Restore Mode)

$safeModeAdminPassword = Read-Host -Prompt "Enter the DSRM password" -AsSecureString

# Promote the server as an additional Domain Controller in the existing domain

Install-ADDSDomainController -DomainName $domainName -InstallDns -Credential $domainAdminCreds -SafeModeAdministratorPassword $safeModeAdminPassword -Confirm:$false -Force
PowerShell Adding New Domain Controller
  • 31
  • 0
Code:
# Install the AD DS role if it's not already installed
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

# Define the new domain and forest details
$domainName = "yournewdomain.com"   # Replace with your new domain name
$forestName = $domainName           # Typically, forest name = domain name for a new forest
$netbiosName = "YOURDOMAIN"         # Replace with NetBIOS name of the domain (15 characters max)
$safeModeAdminPassword = Read-Host -Prompt "Enter the DSRM password" -AsSecureString

# Install a new forest and promote the server to a Domain Controller
Install-ADDSForest -DomainName $domainName -DomainNetbiosName $netbiosName -SafeModeAdministratorPassword $safeModeAdminPassword -InstallDns -Force
Blog Introducing Canvas: A New Tool to Interact with AI
  • 29
  • 0

Introducing Canvas: A New Tool to Interact with AI​

The way we interact with AI is about to change in a big way. OpenAI has just introduced Canvas, a new tool designed to make collaborating with AI more intuitive and creative. If you've ever wished you could organize AI-generated ideas in a space that feels both flexible and visual, Canvas might be the solution you've been looking for.

What Is Canvas?​

Canvas is a visual interface that allows you to explore, arrange, and iterate on AI-generated content. Imagine having an AI assistant that doesn't just give you responses in a long document but instead helps you create a board full of possibilities that you can manipulate in real time. With Canvas, your ideas aren't linear—they can be reshaped, moved, and connected, just like notes on a whiteboard or sticky notes on a wall.

For example, if you're brainstorming ideas for a project, Canvas lets you see all the AI suggestions at once. You can...
Back
Top