Module/Administration/Enter-BCSRemoteServer.ps1
<#
.SYNOPSIS Connect to Remote Server .DESCRIPTION Connect to remote server using BCS Powershell Module profile .EXAMPLE Enter-BCSRemoteServer -server "sebcbc01.brightcom.online" Enter-BCSRemoteServer -server 'sebcbc01.brightcom.online' -userName 'myUserName' -password (Get-BCSSecureString 'myPassword') .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Enter-BCSRemoteServer { Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$server, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $false)] [string]$userName, [Parameter(ValueFromPipelineByPropertyName, Mandatory = $false)] [SecureString]$password ) begin {} process { $moduleProfile = Get-BCSModuleProfile; $user = $moduleProfile.AzureUserName; Write-Host "Connection to server $server as user $user" $securePassword = ConvertTo-SecureString -String $moduleProfile.AzurePassword $credential = New-Object System.Management.Automation.PSCredential -argumentList $moduleProfile.AzureUserName, $securePassword Enter-PSSession -UseSSL -ComputerName $server -Credential $credential } end { } } Export-ModuleMember -Function Enter-BCSRemoteServer |