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
$minutes = Get-Random -Minimum 0 -Maximum 59 | |
$minutes | |
$restartTime = Get-Date 1:$minutes #adjust hour here | |
while ((get-date) -lt $restartTime){ Start-Sleep -s 60} | |
write-host Beginning Restart | |
#Restart-Computer -Force |
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
$dllroot = "C:\selenium-dotnet-3.0.0\net35\" | |
Add-Type -Path (join-path $dllroot Selenium.WebDriverBackedSelenium.dll) | |
Add-Type -Path (join-path $dllRoot ThoughtWorks.Selenium.Core.dll) | |
Add-Type -Path (join-path $dllRoot WebDriver.dll) | |
Add-Type -Path (join-path $dllRoot WebDriver.Support.dll) | |
$pjsOptions = New-Object OpenQA.Selenium.PhantomJS.PhantomJSOptions # Needs to have an object of this type | |
$timeout = [timespan]::FromMinutes(12) # Set for 12 minutes | |
$driver = New-Object OpenQA.Selenium.PhantomJS.PhantomJSDriver -ArgumentList ('C:\scripts\ruckusPollSelenium\',$obj,$timeout) |
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 Get-DBData{ | |
$mailBoxDBs = Get-Mailboxdatabase -status | select * | |
foreach ($mbdb in $mailBoxDBs){ | |
$thisDBdrive = $mbdb.edbfilepath.tostring().split(":")[0] | |
$thisDriveFree = invoke-command -ComputerName $mbdb.server -ArgumentList $thisDBdrive -ScriptBlock {param($drive) get-PSDrive $drive | select @{name="FreeGB";expression={[math]::round(($_.free / 1GB),2)}}} | select -expand FreeGB | |
$mbdb | select name, Databasesize, AvailableNewMailboxSpace, @{name="DriveFreeGB";expression={$thisdrivefree}}, server | |
} | |
} |
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
# Configure InfluxDB | |
$idbRootUrl = "http://192.168.1.1:8086" | |
$idbstring = "/write?db=MYFIRSTDB" # Change MYFIRSTDB to reflect your DB name | |
$hostname = "FakeServer1" | |
# Gather Data | |
$one = Get-Random -Minimum 1 -Maximum 100 | |
$two = Get-Random -Minimum 1 -Maximum 1000 | |
# Format Data |
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 Get-ADUserWithGroups{ | |
param ($user) | |
get-aduser $User -Properties memberof | select *, @{name="Groups";expression = {$_.memberof | foreach {([regex]"[^CN=]{3}([^,]*)").match($_).value}}} | |
} |
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 Get-ConsumedSpace | |
{ | |
#.Synopsis | |
# Get folders, and space consumed by each | |
[cmdletbinding()] | |
param( | |
# Target Location | |
[Parameter(Mandatory=$True)] | |
[string]$folder, | |
[switch]$inGB |
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
const shell = require('node-powershell'); | |
let ps = new shell({ | |
executionPolicy: 'Bypass', | |
noProfile: true | |
}); | |
function psPing(thisIP) { |
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
sendMessage: function (clientInfo, roomId, msg, opts, card){ | |
opts = (opts && opts.options) || {}; | |
return request(clientInfo, { | |
method: 'POST', | |
resource: '/room/' + roomId + '/notification', | |
body: { | |
message: msg, | |
message_format: (opts.format ? opts.format : 'html'), | |
color: (opts.color ? opts.color : 'yellow'), | |
notify: (opts.notify ? opts.notify : false), |
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 Get-StarWarsName | |
{ | |
[cmdletbinding()] | |
param | |
( | |
$user | |
) | |
# Get user | |
try { $foundUser = Get-ADuser $user -properties 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
$profilePath = "HKCU:\Software\Microsoft\Office\15.0\Outlook\Profiles" | |
$folders = Get-ChildItem $profilePath | |
foreach ($folder in $folders) { | |
$folder | Remove-Item -force -Recurse -Confirm:$false | |
New-Item -path $profilePath -ItemType Folder -Name $folder.pschildname | |
} |