Skip to content

Instantly share code, notes, and snippets.

View jacksoneyton's full-sized avatar

Jackson Eyton jacksoneyton

  • South Dakota
View GitHub Profile
@jacksoneyton
jacksoneyton / 0_reuse_code.js
Created December 9, 2015 15:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Get-CsAdUser -ResultSize Unlimited | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled} | Disable-CsUser
@jacksoneyton
jacksoneyton / CreateFoldersFromADUserNames.ps1
Last active December 16, 2015 16:26
PoSH Folder from AD
Import-Module ActiveDirectory $InternalADUsers = Get-ADGroupMember -Identity Internal | select-object -ExpandProperty SamAccountName #foreach {$_.SamAcountName} Foreach ($I in $InternalADUsers) { $SignaturesPath = "S:\Signatures\$I" write-host "$SiganturesPath" #if(Test-Path = $SignaturesPath) # { # Write-Host "$SignaturePath exists" # } }
@jacksoneyton
jacksoneyton / ConnectTo-ExchangeShell
Created February 26, 2016 18:05
ConnectTo-ExchangeShell
function ConnectTo-ExchangePS {
<#
.SYNOPSIS
Gathers information about exchange to automatically run the correct Exchange PS
.DESCRIPTION
Imports exchange modules and connects to the exchange server, this allows exchange PS scripts
to be run directly from a standard powershell window.
.NOTES
$qtVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "quicktime" } |
Select-Object -Property DisplayName, UninstallString
ForEach ($ver in $qtVer) {
If ($ver.UninstallString) {
$uninst = $ver.UninstallString
@jacksoneyton
jacksoneyton / get-ProcessDLL.ps1
Created April 22, 2016 20:55
Get DLL's of running process
Get-Process $processname | select -ExpandProperty modules| Format-Table -Wrap -AutoSize -property company, filename| out-string -width 1024
@jacksoneyton
jacksoneyton / DeployLT.bat
Created May 3, 2016 19:04
Labtech Agent GP Deploy Bat
@REM specify ID at time of execution: deploy.bat ### (### = the actual client ID number)
if %1%=="0" GOTO END
IF NOT EXIST C:\WINDOWS\LTSVC GOTO Install
GOTO END
:Install
SET ID=%1%
IF "%ID%"=="" SET /P ID="What is the Site ID: "
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://lt1.arrc.com/Labtech/Deployment.aspx?Probe=1&ID=%ID%', '%TEMP%\Agent_Install.exe')"
%TEMP%\Agent_Install.exe /s
SELECT clients.name AS 'ClientName',comp.name AS 'ComputerName', COUNT(H.installed) AS '# Patches Missing',comp.lastcontact AS 'Last Checked In'
FROM hotfix AS H, computers AS comp, clients
WHERE H.installed=0
AND H.approved=1
AND comp.computerid=H.computerid
AND comp.clientid=clients.clientid
AND comp.clientid=220
GROUP BY comp.name
ORDER BY comp.lastcontact DESC
SELECT `computers`.`name` AS 'PC Name',
`computers`.`ComputerID` AS 'Agent ID',
`computers`.`OS` AS 'OS',
`computers`.`LastContact` AS 'Last Contact',
COUNT(hotfixid) AS 'Updates Pending'
FROM `hotfix`
JOIN `computers`ON ( `hotfix`.`ComputerID` = `computers`.`ComputerID` )
JOIN clients ON (computers.clientid=clients.clientid)
WHERE `hotfix`.`Installed`=0 AND `hotfix`.`Approved`=1
AND clients.clientid NOT IN (33)
SELECT cmd.`ComputerID` AS 'ID',
cl.name AS 'Client',
c.name AS 'Hostname',
c.OS AS 'OS',
cmd.DateUpdated AS 'Start Time',
(LENGTH (cmd.parameters) - LENGTH(REPLACE(cmd.parameters,',','')))+1 AS 'Patches Installing',
(ROUND(TIME_TO_SEC(TIMEDIFF(NOW(),cmd.DateUpdated))/60)-1) AS 'Elapsed Time (m)'
FROM commands cmd
JOIN computers c ON (c.computerid = cmd.computerid)
JOIN clients cl ON (cl.clientid = c.clientid)