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
Function Format-FileSize() { | |
Param ([int]$size) | |
If ($size -gt 1TB) {[string]::Format("{0:0.00} TB", $size / 1TB)} | |
ElseIf ($size -gt 1GB) {[string]::Format("{0:0.00} GB", $size / 1GB)} | |
ElseIf ($size -gt 1MB) {[string]::Format("{0:0.00} MB", $size / 1MB)} | |
ElseIf ($size -gt 1KB) {[string]::Format("{0:0.00} kB", $size / 1KB)} | |
ElseIf ($size -gt 0) {[string]::Format("{0:0.00} B", $size)} | |
ElseIf ($size -eq 0) {"0 MB"} | |
Else {""} | |
} |
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
#Requires -Version 3.0 | |
Function Format-FileSize { | |
Param ([int64]$Size) | |
# Based on File.Length in bytes return appropriate size | |
Switch($Size) | |
{ | |
{ $_ -gt 1TB } | |
{"{0:0.00} TB" -f ($Size / 1TB); break} |
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
// Change this values based on your spreadsheet. | |
var SHEET_NAME = 'Form Responses 1'; | |
var STATUS_COLUMN_NUMBER = 4; | |
var PROCESSED_STATUS = 'Processed'; | |
var LAST_ROW_KEY = 'lastRow'; | |
var LOCK_TIMEOUT_MS = 60000; // 1 minute | |
var MAX_RUNTIME_MS = 240000; // 4 minutes | |
/** |
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
function isTimeUp_(start) { | |
var now = new Date(); | |
return now.getTime() - start.getTime() > 300000; // 5 minutes | |
} | |
function myFunction() { | |
var threads = GmailApp.getInboxThreads(0, 50); | |
var start = new Date(); | |
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
/** Build a menu item | |
From https://developers.google.com/apps-script/guides/menus#menus_for_add-ons_in_google_docs_or_sheets | |
**/ | |
function onOpen(e) { | |
var menu = SpreadsheetApp.getUi().createMenu('Sort'); | |
if (e && e.authMode == ScriptApp.AuthMode.NONE) { | |
// Add a normal menu item (works in all authorization modes). | |
menu.addItem('Sort Sheet', 'sort'); | |
} else { |
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
function onOpen(){ | |
SpreadsheetApp.getUi().createMenu("OI Tracker") | |
.addItem("Zero out cells", "zeroOutOitSheet") | |
.addItem("List OI and LP", "listOiLp") | |
.addToUi(); | |
} | |
function refreshImport() { | |
var queryString = Math.random(); | |
//Logger.log("random: " + queryString); |
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
/** Brings two columns of strings together. | |
* | |
* @param {string} First string. | |
* @param {string} Second string. | |
* @return both strings together. | |
* @customfunction | |
**/ | |
function COMBINESTRINGS(first, second) { | |
return first + ' ' + second; | |
} |
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
Import-Module C:\Users\USERPROFILE\Downloads\UIAutomation.0.8.7B3.NET40\UIAutomation.dll | |
[UIAutomation.Preferences]::Highlight = $false | |
[UIAutomation.Preferences]::Log = $false | |
[UIAutomation.Preferences]::AutoLog = $false | |
[UIAutomation.Preferences]::OnErrorScreenShot = $false | |
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue | |
function Connect-VPN() { | |
$vpnUI = Get-Process | Where-Object {$_.Name -like "vpnui"} | |
if($vpnUI){ |
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
# Get Password into txt file | |
Read-Host "Enter Password" -AsSecureString | ConvertFrom-SecureString | Out-File "C:\Temp\Password.txt" | |
# Read it from text file. | |
$pass = Get-Content "C:\Temp\Password.txt" | ConvertTo-SecureString | |
$passwordplain = ConvertFrom-SecureToPlain $pass | |
$passwordplain |
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
New-ADUser -EmployeeID $employeeId -SamAccountName $newLogin -UserPrincipalName $userPrincipalName | |
-GivenName $firstName -Surname $lastName -DisplayName $displayName -path $path | |
-Company $company -Fax $fax -OfficePhone $phone | |
-Title $title -EmailAddress $email -Enabled 1 -name $name | |
-AccountPassword (ConvertTo-SecureString -AsPlainText $password -Force) -ChangePasswordAtLogon 1 | |
New-ADUser -EmployeeID '10551' -SamAccountName 'taylortobaben' -UserPrincipalName 'taylortobaben@samim.com' | |
-GivenName 'Taylor' -Surname 'Tobaben' -DisplayName 'Tobaben, Taylor' -path 'Immediadent' | |
-Company 'Immediadent' -Fax '' -OfficePhone '9132232051' | |
-Title 'Test Title' |
OlderNewer