Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Current profile - just a few useful aliases and functions for what I often do in PowerShell
Set-Alias subl 'C:\Program Files\Sublime Text 2\sublime_text.exe'
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
You can’t perform that action at this time.