This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $content = Get-Content -path C:\blah.png -encoding byte | |
| $base64 = [System.Convert]::ToBase64String($content) | |
| $base64 | Out-File C:\encoded.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ADGroup -Filter * -Properties Members | where { $_.Members.Count -eq 0 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $UserNameEntry = Read-Host -Prompt 'Enter Username' | |
| $PasswordLastSet = (Get-ADUser -Identity $UserNameEntry -Properties PasswordLastSet).PasswordLastSet | |
| Write-output ($UserNameEntry + " : " + $PasswordLastSet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Date Formatting | |
| $datestring = (Get-Date).ToString("s").Replace(":","-") | |
| (Get-Date -format g) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Prompt for entry | |
| $UserNameEntry = Read-Host -Prompt 'Enter Username' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Out-Excel { | |
| param($Path = "$env:temp$(Get-Date -Format yyyyMMddHHmmss).csv") | |
| $input | Export-CSV -Path $Path -UseCulture -Encoding UTF8 -NoTypeInformation | |
| Invoke-Item -Path $Path | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import-Module ActiveDirectory | |
| Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin | |
| $list = Import-Csv "C:\Users.csv" | |
| foreach ($entry in $list) { | |
| Enable-Mailbox -Identity ("User\" + $entry.samAccountName) -Database "Enter db here" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import-Module ActiveDirectory | |
| $users = Import-CSV ".\users.csv" | |
| foreach ($user in $users) { | |
| Remove-ADGroupMember -Identity $user.GroupName -Member $user.SamAccountName | |
| } |