Skip to content

Instantly share code, notes, and snippets.

View leeramsay's full-sized avatar

Lee Ramsay leeramsay

  • Perth, West Australia
View GitHub Profile
@leeramsay
leeramsay / Google_Chrome_PSADT-Deploy-Application.ps1
Last active February 21, 2024 21:31
PSADT - Google Chrome Enterprise Deployment
<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an application(s).
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
.PARAMETER DeploymentType
The type of deployment to perform. Default is: Install.
@leeramsay
leeramsay / PSADT-Cheatsheet.ps1
Last active November 12, 2024 19:46
PSADT snippits/cheatsheet
## Commonly used PSADT env variables
$envCommonDesktop # C:\Users\Public\Desktop
$envCommonStartMenuPrograms # C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$envProgramFiles # C:\Program Files
$envProgramFilesX86 # C:\Program Files (x86)
$envProgramData # c:\ProgramData
$envUserDesktop # c:\Users\{user currently logged in}\Desktop
$envUserStartMenuPrograms # c:\Users\{user currently logged in}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$envSystemDrive # c:
$envWinDir # c:\windows
@leeramsay
leeramsay / gather_ad_sitename.sh
Last active June 1, 2022 17:07
gather AD site name on macOS, tested on 10.11 & 10.12
#!/bin/bash
[ $EUID -ne 0 ] && { echo "$0 must be run as root"; exit 1; }
AD_Forest=$(dscl localhost -list "/Active Directory")
AD_SiteName=$(/usr/libexec/PlistBuddy -c "print ActiveDirectory:sitename" "/Library/Preferences/OpenDirectory/DynamicData/Active Directory/${AD_Forest}.plist")
echo ${AD_SiteName}
#!/usr/bin/env ruby
ComputerName = `scutil --get ComputerName`.strip
ADGroupAttribute = 'dsAttrTypeNative:memberOf'
GroupAttributeSeparator = /\s*(?=CN=)/
PlistGroupKey = 'directory_groups'
ManagedInstallDir=`defaults read /Library/Preferences/ManagedInstalls ManagedInstallDir`.strip
PlistLocation = File.join( "#{ManagedInstallDir}", "Conditionalitems" )
@leeramsay
leeramsay / Deploy-Application.ps1
Created August 19, 2016 06:19
Deploy VMware Workstation 11.2.xxxx
<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an application(s).
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
.PARAMETER DeploymentType
The type of deployment to perform. Default is: Install.
$SiteServer = 'SERVER NAME
$SiteCode = 'SITE CODE'
$CollectionName = 'NAME OF COLLECTION'
$cred = Get-credential
#Retrieve SCCM collection by name
$Collection = get-wmiobject -ComputerName $siteServer -NameSpace "ROOT\SMS\site_$SiteCode" -Class SMS_Collection -Credential $cred | where {$_.Name -eq "$CollectionName"}
#Retrieve members of collection
$SMSMemebers = Get-WmiObject -ComputerName $SiteServer -Credential $cred -Namespace "ROOT\SMS\site_$SiteCode" -Query "SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='$($Collection.CollectionID)' order by name" | select Name
@leeramsay
leeramsay / remove-fb-tracking.user.js
Last active July 8, 2016 11:57 — forked from k-barton/remove-fb-tracking.user.js
Greasemonkey user script: Remove Facebook's external link tracking
// ==UserScript==
// @name Remove Facebook's external link tracking
// @description Removes redirection from external FB links
// @namespace https://gist.github.com/k-barton
// @include https://*.facebook.com*
// @include http://*.facebook.com*
// @version 0.1.0
// @grant none
// ==/UserScript==
@leeramsay
leeramsay / add_computers_to_gpo.ps1
Last active June 11, 2024 14:09
Simple Powershell to add computers, for my own poor memory, to add a computer, or multiples, to a group policy object under the "security filtering" section.
#To add:
# - Powershell Min version
# - Ad tools detection?
# - Instructions how to undo/remove computer/computers
# - Ability to run interactively, instead of copy/pasta
#Variables
$Domain = "example.domain"
$GPO_Name = "example GPO object"
$Computers_To_Add = "Example_PC1","Example_PC2","Example_PC3"
@leeramsay
leeramsay / find_usertemplate_modification.sh
Last active September 2, 2015 12:48
Bash script to parse installed Mac OS pkgs, and find any that have modified the default user template.
#!/bin/bash
# Find packages that have touched the default profile.
# Edit this to your org string for your packages.
# All your packages have a consistent org string, I hope!
# I'd suggest you pipe this script into more, or output to a text file for readability.
# EDIT ME