Script to unlock Bitlocker encrypted drive at startup using task scheduler

=============================================


# Run as Administrator

$DriveLetter = "E:"

$Password = "Welcome@1989!"  # Replace with the actual BitLocker password

# Convert plain text password to secure string

$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force

# Unlock the drive

Unlock-BitLocker -MountPoint $DriveLetter -Password $SecurePassword


# Enable auto-unlock (stores the key protector securely so password not needed at startup)

Enable-BitLockerAutoUnlock -MountPoint $DriveLetter


Create Task Scheduler
















Select Start a program

Program/Script: powershell.exe

Add Arguments: -ExecutionPolicy Bypass -File "C:\Scripts\AutoUnlockBitlockerdrive.ps1"













PowerShell Command to create bulk users in Active Directory



User Template format 





# Import users from CSV

$users = Import-Csv -Path "C:\temp\users.csv"


foreach ($user in $users) {

$samAccountName = $user.LoginID

$displayName = $user.DisplayName

$email = $user.Email

$depatment=$User.Department

$password = ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force


    # Create user

New-ADUser `

-Name $displayName `

-SamAccountName $samAccountName `

-UserPrincipalName "$samAccountName@ads.com" `

-DisplayName $displayName `

-EmailAddress $email `

-Department $depatment `

-AccountPassword $password `

-Enabled $true `

-Path "OU=VDI,DC=ads,DC=com"

    

Write-Host "Created user: $displayName ($samAccountName)"

}

Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...