Skip to content

Instantly share code, notes, and snippets.

# Site configuration
$SiteCode = "TES" # Site code
$ProviderMachineName = "Primary.domain.LOCAL" # SMS Provider machine name
# Customizations
$initParams = @{}
#$initParams.Add("Verbose", $true) # Uncomment this line to enable verbose logging
#$initParams.Add("ErrorAction", "Stop") # Uncomment this line to stop the script on any errors
$argument = '/installtunnelservice "C:\Program Files\WireGuard\Data\Configurations\wg0.conf"'
$action = New-ScheduledTaskAction -Execute 'C:\Program Files\WireGuard\wireguard.exe' -Argument $argument
$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$trigger = New-ScheduledTaskTrigger -AtStartup
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger
Register-ScheduledTask "WireGuard" -InputObject $task -Force -TaskPath "Custom"
@NathanTheGr8
NathanTheGr8 / Get-DellModelReleaseDates.ps1
Created November 9, 2020 05:22
This script will download and extract the latest Dell Driver Cab to use it to determine the release dates of all dell models
<#
.SYNOPSIS
Export CSV of Dell Models and their release dates
.DESCRIPTION
This script will download and extract the latest Dell Driver Cab to use it to determine the release dates of all dell models
.NOTES
Param(
[Parameter(Mandatory = $True)]
[string[]]$UserIDs,
[Parameter(Mandatory = $True)]
[int]$Duration
)
foreach ($UserID in $UserIDs) {
$GrantAdminTo = "Domain\" + $UserID
@NathanTheGr8
NathanTheGr8 / Powershell_ADR_Rule.ps1
Created December 13, 2019 21:02
create a new SCCM Automatic Deployment Rule with powershell
$parms2 = @{
Description = "PS Test"
Name = "Windows Updates - Office 365 x86"
Path = "\\pathToFileShare\sccm\Software_Library\Updates\Windows Updates - Office 365 x86"
Priority = "Low"
}
New-CMSoftwareUpdateDeploymentPackage @parms2
$parms = @{
$OneDriveFolder = "$home\OneDrive\Documents\.backup"
$Date = Get-Date -Format "MM-dd-yyyy"
$logFile = "$OneDriveFolder\Backup-UserFoldersLog_$Date.log"
Start-Transcript -Path "$logFile" -Append -Force
if(!(Test-Path -Path $OneDriveFolder)){
New-Item -Path $OneDriveFolder -ItemType Directory
}
if (!((get-item $OneDriveFolder -Force).Attributes.HasFlag([System.IO.FileAttributes]::Hidden))) {
Write-Output "Hiding backup folder $OneDriveFolder"
@NathanTheGr8
NathanTheGr8 / Deploy-Application.ps1
Created August 12, 2019 19:02
PSADT Google Chrome
<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).
# LICENSE #
PowerShell App Deployment Toolkit - Provides a set of functions to perform common application deployment tasks on Windows.
Copyright (C) 2017 - Sean Lillis, Dan Cunningham, Muhammad Mashwani, Aman Motazedian.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an applica
#Load Assembly and Library
Add-Type -AssemblyName PresentationFramework
#XAML form designed using Vistual Studio
#[xml]$Form = Get-Content -Path "$PSScriptRoot\USMTGUI.xaml"
[xml]$Form = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Migration Assistant by Nick Rodriguez" Height="600" Width="1000" MinWidth="1000" MinHeight="600">
<Grid>
@NathanTheGr8
NathanTheGr8 / TestWPF.ps1
Created December 31, 2018 22:03
Example Powershell WPF Form
#Load Assembly and Library
Add-Type -AssemblyName PresentationFramework
#XAML form designed using Vistual Studio
#[xml]$Form = Get-Content -Path "$PSScriptRoot\USMTGUI.xaml"
[xml]$Form = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Migration Assistant by Nick Rodriguez" Height="550" Width="1000" MinWidth="1000" MinHeight="550">
<Grid>
@NathanTheGr8
NathanTheGr8 / kb3140245.ps1
Created September 26, 2018 15:10
Enabling TLS 1.1 and 1.2. Taken from https://pastebin.com/yH8ZVzM0
$TLS1dot1 = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client'
$TLS1dot2 = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client'
$MicrosoftWinHttp = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp'
$Wow6432Node = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp'
If (!(test-path $TLS1dot1))
{
New-Item $TLS1dot1 -Force | New-ItemProperty -Name DisabledByDefault -Value 0 -Force
}
else