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
/** 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
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
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' |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 Set-UserGroups($loginName, $employeeType, $dept, $state, $regionId, $pc) | |
{ | |
# Load the groups from the external group_arrays file. | |
# Use this file to manage all groups and changes to groups | |
# Blocking out for now and loading the groups as part of this main script. | |
#. .\group_arrays.ps1 | |
# THESE ARE SAMSON EMPLOYEE groups | |
$SAMSON_Array = @("!All_Samson_Employees", "!SamsonEmployees", "Domain Users", "Infosource", "Samson_Internet") |
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
Start-Transcript -Path "C:\bin\ps\Account_Automation\TestAD.txt" | |
# Import the Active Directory cmdlets | |
Import-Module ActiveDirectory | |
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' -EmailAddress 'taylortobaben@immediadent.com' -Enabled 1 -name 'Taylor Tobaben' | |
-AccountPassword (ConvertTo-SecureString -AsPlainText '1234!$SamsonDent' -Force) -ChangePasswordAtLogon 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
# 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 |
OlderNewer