-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
1,542 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Requires WebClient object $webClient defined, e.g. $webClient = New-Object System.Net.WebClient | ||
# | ||
# Parameters: | ||
# $source - The url of folder to copy, with trailing /, e.g. http://website/folder/structure/ | ||
# $destination - The folder to copy $source to, with trailing \ e.g. D:\CopyOfStructure\ | ||
# $recursive - True if subfolders of $source are also to be copied or False to ignore subfolders | ||
|
||
Function Copy-Folder([string]$source, [string]$destination, [bool]$recursive) { | ||
if (!$(Test-Path($destination))) { | ||
New-Item $destination -type directory -Force | ||
} | ||
|
||
# Get the file list from the web page | ||
$webString = $webClient.DownloadString($source) | ||
$lines = [Regex]::Split($webString, "<br>") | ||
# Parse each line, looking for files and folders | ||
foreach ($line in $lines) { | ||
if ($line.ToUpper().Contains("HREF")) { | ||
# File or Folder | ||
if (!$line.ToUpper().Contains("[TO PARENT DIRECTORY]")) { | ||
# Not Parent Folder entry | ||
$items = [Regex]::Split($line, """") | ||
$items = [Regex]::Split($items[2], "(>|<)") | ||
$item = $items[2] | ||
if ($line.ToLower().Contains("<dir>")) { | ||
# Folder | ||
if ($recursive) { | ||
# Subfolder copy required | ||
Copy-Folder "$source$item/" "$destination$item/" $recursive | ||
} | ||
else { | ||
# Subfolder copy not required | ||
} | ||
} | ||
else { | ||
# File | ||
$webClient.DownloadFile("$source$item", "$destination$item") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Function Install-MSI { | ||
Param ( | ||
[Parameter(Mandatory, ValueFromPipeline = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.IO.FileInfo]$File, | ||
[String[]]$AdditionalParams, | ||
[Switch]$OutputLog | ||
) | ||
$DataStamp = get-date -Format yyyyMMddTHHmmss | ||
$logFile = "$($env:programdata)\CentraStage\MilesRMM\{0}-{1}.log" -f $file.fullname, $DataStamp | ||
$MSIArguments = @( | ||
"/i", | ||
('"{0}"' -f $file.fullname), | ||
"/qn", | ||
"/norestart", | ||
"/L*v", | ||
$logFile | ||
) | ||
if ($additionalParams) { | ||
$MSIArguments += $additionalParams | ||
} | ||
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow | ||
if ($OutputLog.IsPresent) { | ||
$logContents = get-content $logFile | ||
Write-Output $logContents | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#!/bin/sh | ||
#################################################################################################### | ||
# | ||
# Copyright (c) 2017, JAMF Software, LLC. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of the JAMF Software, LLC nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY | ||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
#################################################################################################### | ||
# | ||
# ABOUT THIS PROGRAM | ||
# | ||
# NAME | ||
# enableFilewall.sh -- Enables or Disables the firewall on macOS. | ||
# | ||
# SYNOPSIS | ||
# sudo enableFirewall.sh | ||
# sudo enableFirewall.sh <mountPoint> <computerName> <currentUsername> <enableFirewall> | ||
# | ||
# If there is a hardcoded value specified for <enableFirewall> in the script, | ||
# or if the parameter is not passed by Jamf Pro, the hardcoded value in the script will | ||
# be used. | ||
# | ||
# The data that is specified for the <enableFirewall> parameter should be specified in one of | ||
# the following formats. PLEASE NOTE these formats are CASE-SENSITIVE: | ||
# | ||
# "TRUE" or "true" or "YES" or "yes" -> Turn Firewall ON | ||
# "FALSE" or "false" or "NO" or "no" -> Turn Firewall OFF | ||
# | ||
# Example Usage: sudo enableFirewall.sh "mountPoint" "computerName" "currentUsername" "TRUE" | ||
# | ||
# DESCRIPTION | ||
# This script enables or disables the firewall on macOS 10.7 or later. | ||
# It can be used with a hardcoded value in the script, or read in as a parameter. | ||
# Since Jamf Pro defines the first three parameters as (1) Mount Point, (2) Computer | ||
# Name and (3) Username, we are using the fourth parameter ($4) as the passable parameter to | ||
# acquire the status of <enableFirewall>. In addition, the fourth parameter is utilized to set | ||
# the enableFirewall value. | ||
# | ||
#################################################################################################### | ||
# | ||
# HISTORY | ||
# | ||
# Version: 1.2 | ||
# | ||
# - Created by Nick Amundsen on August 6th, 2008 | ||
# - Updated by Nick Amundsen on January 21, 2010 | ||
# - Updated by Brandon Wenger on November 27th, 2017 | ||
# - Updated by Matthew Mitchell on March 22, 2019 | ||
# | ||
#################################################################################################### | ||
# | ||
# DEFINE VARIABLES & READ IN PARAMETERS | ||
# | ||
#################################################################################################### | ||
|
||
# HARDCODED VALUE FOR "enableFirewall" IS SET HERE | ||
enableFirewall="" | ||
|
||
# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "enableFirewall" | ||
if [ "$4" != "" ] && [ "$enableFirewall" == "" ]; then | ||
enableFirewall=$4 | ||
fi | ||
|
||
#################################################################################################### | ||
# | ||
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE | ||
# | ||
#################################################################################################### | ||
|
||
#Check to make sure enableFirewall is not blank | ||
if [ "$enableFirewall" == "" ]; then | ||
echo "Error: The parameter 'enableFirewall' is blank. Please specify a value for parameter 4." | ||
exit 1 | ||
fi | ||
|
||
#Get the current macOS version (the major release) to check for compatibility | ||
#This will return the 'x' in 10.x | ||
OS=`/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,5)}' | cut -d . -f2` | ||
|
||
#If the macOS version is greater than or equal to 10.7 | ||
if [[ $OS -ge 7 ]]; then | ||
|
||
#Check parameter value, if true or yes, turn the firewall on | ||
case $enableFirewall in "true" | "TRUE" | "yes" | "YES") | ||
echo "Enabling Firewall for macOS 10.$OS ..." | ||
/usr/bin/defaults write /Library/Preferences/com.apple.alf globalstate -int 1;; | ||
|
||
#If false or no, turn the firewall off | ||
"false" | "FALSE" | "no" | "NO") | ||
echo "Disabling Firewall for macOS 10.$OS ..." | ||
/usr/bin/defaults write /Library/Preferences/com.apple.alf globalstate -int 0;; | ||
esac | ||
|
||
else | ||
|
||
#The macOS version is not supported | ||
echo "Unsupported macOS version - 10.7 or later is required." | ||
|
||
fi | ||
|
||
exit 0; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sudo softwareupdate -ia |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
networksetup -setdnsservers Wi-Fi 1.1.1.1 | ||
networksetup -setdnsservers Wi-Fi 1.0.0.1 | ||
networksetup -setdnsservers Ethernet 1.1.1.1 | ||
networksetup -setdnsservers Ethernet 1.0.0.1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pmset -a restoredefaults | ||
nvram -c |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$domain = "myDomain" | ||
$password = "myPassword!" | ConvertTo-SecureString -asPlainText -Force | ||
$username = "$domain\myUserAccount" | ||
$credential = New-Object System.Management.Automation.PSCredential($username,$password) | ||
Add-Computer -DomainName $domain -OUPath "OU=testOU,DC=domain,DC=Domain,DC=com" -Credential $credential -Restart |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Transfer FSMO Roles to server | ||
# Make this machine the FSMO Master role. | ||
|
||
Move-ADDirectoryServerOperationMasterRole -Identity $env:computername -OperationMasterRole pdcemulator,ridmaster,infrastructuremaster,schemamaster,domainnamingmaster -Force |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
manage-bde -protectors C: -get |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## Update this script for your company, Modify the "mail variables" section | ||
## Also, host BlueScreenView.exe on a website and update the $url variable | ||
## location accordingly | ||
## | ||
## Blue Screen View is available as freeware at | ||
## https://www.nirsoft.net/utils/blue_screen_view.html | ||
|
||
|
||
###script variables | ||
$scriptName = "Blue Screen View" | ||
$computerName = (get-wmiObject win32_computersystem).name | ||
$computerDomain = (get-wmiObject win32_computersystem).domain | ||
if($computerdomain -notlike '*.*'){ #if there's no period in the domain, (workgroup) | ||
$computerDomain = "$computerDomain.local" | ||
} | ||
|
||
###mail variables | ||
$smtpServer = 'mail.server.com' | ||
$smtpPort = '25' | ||
$smtpFrom = "Atera-$computername@$computerdomain" | ||
$smtpTo = 'support@YOURDOMAIN.com' | ||
$messageSubject = "Atera Script: $computerName, $scriptName" | ||
$attachment = "c:\windows\temp\crashes.html" | ||
$messageBody += "----See Attachment----" | ||
|
||
###script start | ||
$messageBody = "----Blue Screen View Results----`r`n" | ||
$url = "https://YOURDOMAIN.com/files/BlueScreenView.exe" | ||
$filename = "BlueScreenView.exe" | ||
$client = New-Object System.Net.WebClient | ||
$client.DownloadFile($url, "$env:temp\$filename") | ||
Start-Process -FilePath "$env:temp\$filename" -ArgumentList "/shtml","c:\Windows\temp\crashes.html","/sort 2","/sort ~1""" | ||
|
||
###send mail | ||
Send-MailMessage -Port $smtpPort -SmtpServer $smtpServer -From $smtpFrom -To $smtpTo -Subject $messageSubject -Body $messageBody -Attachments $attachment |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
function Update-ChocoApps { | ||
<# | ||
.SYNOPSIS | ||
Update choco apps and removes the newly created shortcuts. | ||
.DESCRIPTION | ||
Update choco apps and removes the newly created shortcuts. | ||
Requires administrator privileges. | ||
.NOTES | ||
Author: Chris Stafford | ||
Version: 1.0.5 | ||
Created: 2020.06.17 | ||
Modified: 2020.08.06 | ||
#> | ||
|
||
# Require Admin Permissions | ||
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") | ||
|
||
if ($IsAdmin -eq $false) { | ||
Write-Warning 'Admin Rights Required' | ||
break | ||
} | ||
|
||
$StartTime = Get-Date | ||
|
||
# Aborts if Chocolatey is not installed | ||
if (Test-Path 'C:\ProgramData\chocolatey\choco.exe') { | ||
# Locations for shortcuts to remove | ||
$Desktops = "$env:PUBLIC\Desktop", "$env:USERPROFILE\Desktop" | ||
|
||
$Choco = 'C:\ProgramData\chocolatey\choco.exe' | ||
|
||
# Parse outdated app names from choco (leave the space in ' Outdated*') | ||
Write-Output 'Searching for Outdated Apps' | ||
$AppList = & $Choco outdated --limit-output | ForEach-Object { $_.Split('|')[0] } | ||
|
||
# Skips if no apps are outdated | ||
if ($AppList.Count -gt 0) { | ||
foreach ($App in $AppList) { | ||
# upgrade app | ||
& $Choco upgrade $App --confirm --limit-output --no-progress | ||
|
||
if ($App -like '*.install') { | ||
$App = $App.Split('.')[0] | ||
} | ||
# removes shortcut (created by install) based on the app name and time created | ||
Write-Output "Removing Shortcut: $App" | ||
$Desktops | Get-ChildItem -Filter "*.lnk" -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt $StartTime } | Remove-Item | ||
} | ||
} | ||
else { | ||
Write-Output 'No Outdated Apps' | ||
} | ||
} | ||
else { | ||
Write-Output 'Chocolatey is not installed' | ||
} | ||
} | ||
|
||
Update-ChocoApps |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ECHO -------------------------------------- | ||
ECHO **** Clearing Chrome cache | ||
taskkill /F /IM "chrome.exe">nul 2>&1 | ||
|
||
set ChromeDataDir="C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default" | ||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1 | ||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1 | ||
|
||
|
||
set ChromeDataDir="C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default" | ||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1 | ||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1 | ||
ECHO **** Clearing Chrome cache DONE |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
taskkill /F /IM "chrome.exe">nul 2>&1 | ||
set ChromeDataDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default | ||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1 | ||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1 | ||
|
||
set ChromeDataDir=C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default | ||
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1 | ||
del /q /s /f "%ChromeCache%\*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1 | ||
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1 |
Oops, something went wrong.