This file contains hidden or 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
$AllUsers = Get-Mailbox -ResultSize unlimited | |
$AllUsers | % { | |
$_.UserPrincipalName | |
$PhotoData = $null | |
$PhotoData = Get-UserPhoto -Identity $_.UserPrincipalNAme -ErrorAction SilentlyContinue | |
if ($PhotoData) { | |
[io.file]::WriteAllBytes("$pwd\$($_.UserPrincipalName).jpg",$Photodata.PictureData) | |
} | |
} |
This file contains hidden or 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
$session = New-PSSession -ComputerName MyServer | |
Copy-Item -Path "C:\myfile.txt" -Target "C:\SomeServerFolder" -ToSession $session |
This file contains hidden or 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-ChildItem "C:\mydrivers\" -Recurse -Filter "*.inf" | | |
ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install } |
This file contains hidden or 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
Param( | |
[String]$Path | |
) | |
$pfShortName = ($Path -replace "^\\\\[A-Za-z0-0@\-_. ]*\\All Public Folders\\","").Replace("\","_") | |
$FilePath = Join-Path -Path (Get-Location) -ChildPath "$pfShortName.pst" | |
$outlook = New-Object -ComObject Outlook.Application | |
$namespace = $Outlook.GetNamespace("MAPI") |
This file contains hidden or 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 foreachas { | |
Param( | |
[char]$as, | |
[ScriptBlock]$sb | |
) | |
PROCESS { | |
Set-Variable -Name $as -Value $_ | |
Invoke-Command -ScriptBlock $sb |
This file contains hidden or 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 OnlyWithValues { | |
PROCESS { | |
$properties = $_ | Get-Member | Select -ExpandProperty Name | |
$output = @{} | |
foreach ($property in $properties) { | |
if (-not ([String]::IsNullOrEmpty($_.$property))) { | |
$output[$property] = $_.$Property | |
} | |
} | |
return $output |
This file contains hidden or 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
#!/bin/bash | |
# Number of days old an access key is allowed to be | |
ACCESS_KEY_MAX_AGE=90 | |
# Get every user's username | |
users=`aws iam list-users | jq -r '.Users[] | .UserName'` | |
# Get the oldest Created Date that we can allow (now minus ACCESS_KEY_MAX_AGE days) | |
created_date_limit=`date -d "-$ACCESS_KEY_MAX_AGE days" +%s` |
This file contains hidden or 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
#!/bin/bash | |
EMPTYGRANTS='{"Grants":[]}' | |
buckets=`aws s3api list-buckets --output json | jq -r '.Buckets[].Name'` | |
for bucket in $buckets; do | |
acl=`aws s3api get-bucket-acl --bucket $bucket --output json | jq -c 'del(.Owner) | .Grants |= map( select(.Grantee.URI == "http://acs.amazonaws.com/groups/global/AllUsers") )'` |
This file contains hidden or 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
<# | |
.SYNOPSIS | |
Copies Word Custom Document Properties from one document to another | |
.DESCRIPTION | |
Given two word documents (a source and a target), this script will copy all | |
custom document properties from the source document to the target document. | |
Document properties that already exist in the target document will remain | |
untouched. |
This file contains hidden or 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
// Place your settings in this file to overwrite the default settings | |
{ | |
"window.zoomLevel": 1, | |
"editor.fontSize": 12, | |
"editor.formatOnType": true, | |
"editor.formatOnSave": true, | |
"editor.cursorStyle": "line", | |
"editor.cursorBlinking": "phase", | |
"editor.renderLineHighlight": "all", | |
"editor.renderIndentGuides": true, |