This is a more a note to myself than anything, but when you import the sqlps module it always changes the location to SQL Server drive, this is rather annoying 99% of the time. To load the module and retain your current location use the below

IF (!(Get-Module -Name sqlps))
    {
        Write-Host "Loading SQLPS Module" -ForegroundColor DarkYellow
        Push-Location
        Import-Module sqlps -DisableNameChecking
        Pop-Location 
    }
Advertisements