Skip to content

Instantly share code, notes, and snippets.

Avatar

Lee Ramsay leeramsay

  • Perth, West Australia
View GitHub Profile
@leeramsay
leeramsay / Google_Chrome_PSADT-Deploy-Application.ps1
Last active Jul 16, 2020
PSADT - Google Chrome Enterprise Deployment
View Google_Chrome_PSADT-Deploy-Application.ps1
<#
.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 Nov 26, 2020
PSADT snippits/cheatsheet
View PSADT-Cheatsheet.ps1
## Commonly used PSADT env variables
$envCommonDesktop # C:\Users\Public\Desktop
$envCommonPrograms # 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 Nov 10, 2016
gather AD site name on macOS, tested on 10.11 & 10.12
View gather_ad_sitename.sh
#!/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}
View ad_computer.rb
#!/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 Aug 19, 2016
Deploy VMware Workstation 11.2.xxxx
View Deploy-Application.ps1
<#
.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 / Deploy-Application.ps1
Last active Jul 1, 2020
Trimble Business Center (TBC) 3.6.1 unattended/silent install - PSAppDeployToolkit
View Deploy-Application.ps1
<#
.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.
View get_computers_in_sccm_collection.ps1
$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 Jul 8, 2016 — forked from k-barton/remove-fb-tracking.user.js
Greasemonkey user script: Remove Facebook's external link tracking
View remove-fb-tracking.user.js
// ==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 / google-unmangler.user.js
Last active Jul 8, 2016 — forked from bbqsrc/google-unmangler.user.js
Google Search Unmangler - Greasemonkey Script
View google-unmangler.user.js
// ==UserScript==
// @name Google Search Unmangler
// @namespace ScrewGoogle
// @description Unmangle links right click -> copied from Google Searches URLs
// tld info here: https://publicsuffix.org/list/public_suffix_list.dat
// @include http*://*.google.tld/
// @include http*://*.google.tld/*#*
// @include http*://*.google.tld/webhp*
// @include http*://*.google.tld/search*
@leeramsay
leeramsay / add_computers_to_gpo.ps1
Last active Apr 7, 2016
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.
View add_computers_to_gpo.ps1
#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"
You can’t perform that action at this time.