Last active
November 17, 2022 14:48
-
-
Save chustedde/95e619c86a804258bd536bc5dd080cbb to your computer and use it in GitHub Desktop.
Current profile - just a few useful aliases and functions for what I often do in PowerShell
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 Touch-File | |
{ | |
$file = $args[0] | |
if($file -eq $null) { | |
throw "No filename supplied" | |
} | |
if(Test-Path $file) | |
{ | |
(Get-ChildItem $file).LastWriteTime = Get-Date | |
} | |
else | |
{ | |
echo $null > $file | |
} | |
} | |
Set-Alias touch Touch-File | |
Function Import-SPOModule | |
{ | |
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking | |
} | |
Function Connect-Exchange { | |
$O365Cred = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $O365Cred -Authentication Basic -AllowRedirection | |
Import-PSSession $Session | |
} | |
Function Sign-Script { | |
$file = $args[0] | |
if($file -eq $null) { | |
throw "No filename supplied" | |
} | |
else { | |
$cert = Get-ChildItem cert:\CurrentUser\My -codesign | |
Set-AuthenticodeSignature -FilePath $file -Certificate $cert[0] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Removed alias for Sublime since Sublime Text 4's subl.exe can be added directly to PATH