Skip to content

Instantly share code, notes, and snippets.

View seyerj's full-sized avatar

Josh Seyer seyerj

View GitHub Profile
@seyerj
seyerj / GetADGroupEmails.ps1
Created May 6, 2024 22:56
Get emails of all AD Group Members and send to out-gridview
Get-ADGroupMember -Identity "GroupName" | Get-ADUser -Properties EmailAddress | Select-Object -ExpandProperty EmailAddress | Out-GridView
@seyerj
seyerj / winget-choco-sched.ps1
Created March 13, 2024 16:27
Scheduled task create to update all chocolatey and winget apps at login.
# Define the commands to be scheduled
$commands = @(
"winget upgrade --all --accept-source-agreements --accept-package-agreements",
"choco upgrade all -y"
)
# Define common task properties
$taskAction = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '{0}'
foreach ($command in $commands) {
@seyerj
seyerj / CLI-Upgrade-All.ps1
Created March 13, 2024 16:08
Single line to Update/upgrade all installed Winget and Chocolatey apps
winget upgrade --all --accept-source-agreements --accept-package-agreements ; choco upgrade all -y
@seyerj
seyerj / secureworks-redcloak remove
Created March 1, 2024 21:40
One liner to remove all apps containing secureworks like Red Cloak
get-package *secureworks* | Uninstall-Package
@seyerj
seyerj / get-dns-all.ps1
Created October 18, 2023 21:05
Get all AD DNS Entries sorted and dump to a CSV in c:\temp\
Get-DnsServerResourceRecord -computername DC1 -ZoneName zone.domain.com | Select-Object Hostname,TimeStamp,RecordType,@{Name="IPv4Address";Expression={ [version]$_.RecordData.IPv4Address.IPAddressToString }} | Sort-Object IPv4Address | export-csv -path c:\temp\dns1sort.csv
@seyerj
seyerj / get-cim-uptime.ps1
Created June 6, 2023 20:46
get uptime cim - quick n dirty
Get-CimInstance -ClassName Win32_OperatingSystem | Select LastBootUpTime
winget install -e --id Microsoft.WindowsAdminCenter
@seyerj
seyerj / install-rsat-all.ps1
Created September 15, 2022 23:49
PS install RSAT All Tools
Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online
# Remote EAC Shell
# from: https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-servers-using-remote-powershell?view=exchange-ps
# Get Credentials
$UserCredential = Get-Credential
# Set Session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ServerFQDN>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
# Connect Session
@seyerj
seyerj / enterpsremote.ps1
Created January 10, 2022 19:31
Remote Powershell Session with different credentials prompted
enter-pssession $computername -credential (get-credential)