Skip to content

Instantly share code, notes, and snippets.

View JacobErnst98's full-sized avatar

Jacob Williams-Ernst JacobErnst98

  • PA
  • 01:59 (UTC -05:00)
View GitHub Profile
@JacobErnst98
JacobErnst98 / Microsoft-Win32-Content-Prep-Tool.ps1
Last active May 18, 2023 18:39 — forked from Splaxi/download-latest-release.ps1
Download latest GitHub release of microsoft/Microsoft-Win32-Content-Prep-Tool via Powershell
#Downloads Microsoft-Win32-Content-Prep-Tool
#Returns the pathto the exe.
function get-Win32CPT {
remove-Win32CPT
$repo = "microsoft/Microsoft-Win32-Content-Prep-Tool"
$releasesUri = "https://api.github.com/repos/$repo/releases/latest"
$downloadUri = (Invoke-RestMethod -Method GET -Uri $releasesUri).zipball_url
$pathZip = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $("Microsoft-Win32-Content-Prep-Tool-" + $(Split-Path -Path $downloadUri -Leaf) + ".zip")
$extractPath = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $("Microsoft-Win32-Content-Prep-Tool-" + $(Split-Path -Path $downloadUri -Leaf))
Invoke-WebRequest -Uri $downloadUri -Out $pathZip
@JacobErnst98
JacobErnst98 / Exchange-CopySentItems.ps1
Created June 23, 2020 14:21
Set all shared mailboxes in a given exchange tenant to keep a copy of sent messages
#####
# https://docs.microsoft.com/en-us/exchange/troubleshoot/shared-mailboxes/sent-mail-is-not-saved
#####
Get-Mailbox -Filter {IsShared -eq "True" -and UserPrincipalName -notlike "DiscoverySearchMailbox{*"} | foreach { set-mailbox $_.UserPrincipalName -MessageCopyForSentAsEnabled $True ; set-mailbox $_.UserPrincipalName -MessageCopyForSendOnBehalfEnabled $True }
function import-MerakiNetworkToUnifi {
[CmdletBinding(DefaultParameterSetName='SiteName')]
Param(
[Parameter(Mandatory = $true, ParameterSetName = 'SiteName')]
[string]$SiteName,
[Parameter(Mandatory = $true, ParameterSetName = 'UnifiController')]
[string]$UnifiController,
[string]$Domain
)
@JacobErnst98
JacobErnst98 / enableRdp.ps1
Created March 9, 2020 14:56
Enable Remote desktop via powershell
function EnableRDP {
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
}
@JacobErnst98
JacobErnst98 / Reset-password.ps1
Created March 2, 2020 15:55
Reset a local ad password from the rest value given in office 365, for environments not running azure ad sync
Connect-MsolService
$people = "<sam1>,<sam2>"
$domain = "<@website.com>"
foreach($person in $people){
$tmpPass = Set-MsolUserPassword -UserPrincipalName $($person + $domain)
Set-ADAccountPassword -Identity $person -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $tmpPass -Force)
Add-ADGroupMember -Identity "E2" -Members $person
Write-Host $person "---Password---" $tmpPass
}