Skip to main content
Connect Site
Updated this week

Command

Connect-Site

Description

The command to connect to a SharePoint site.

Note: Should you attempt to pass an invalid site URL in the -Url parameter, ShareGate Migrate will display an error message in the Powershell command line.

Index

Examples

Connect to SharePoint site with current user credentials

Connect-Site -Url "http://myfarm1/sites/mysitecollection"

Connect to SharePoint with username

Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Username "myusername"

Connect to SharePoint with username and password

$mypassword = ConvertTo-SecureString 'mypassword' -AsPlainText -Force
$mysite = Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Username "myusername" -Password $mypassword

Connect to SharePoint site without single sign-on (SSO)

Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Browser -DisableSSO

Connect to SharePoint with proxy settings

$proxySettings = New-ProxySettings -Server myproxyserver -Port 888
Connect-Site -Url "http://myfarm1/sites/mysitecollection" -ProxySettings $proxySettings

Connect to SharePoint using Browser Authentication

Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Browser

Note: To avoid entering your credentials multiple times when you use a foreach loop, see Use credentials from a previous browser connection.

Connect to SharePoint using Browser Authentication with proxy settings

$proxySettings = New-ProxySettings -Server myproxyserver -Port 888
Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Browser -ProxySettings $proxySettings

Connect to SharePoint using existing connection credentials

$connection = Connect-Site -Url "http://myfarm1/sites/mysitecollection" -Browser
Connect-Site -Url "http://myfarm1/sites/anothersitecollection" -UseCredentialsFrom $connection

Connect to SharePoint using existing connection credentials

$connection = Connect-Tenant -Domain mytenantdomain -BrowserConnect-Site -Url "http://mytenantdomain/sites/mysitecollection" -UseCredentialsFrom $connection

Connect and add the SharePoint connection to the Sharegate Explorer

Connect-Site -Url "http://myfarm1/sites/mysitecollection" -AddToExplorer

Connect to SharePoint using a prompt to enter your user name and password

$Credentials = Get-CredentialConnect-Site -Url "http://myfarm1/sites/mysitecollection" -Credential $Credentials

Note: Get-Credential is a Microsoft PowerShell command. When you use it in your script, it opens a prompt on your workstation to allow you to enter your credentials and store them in a variable.

Syntax

Connect-Site-Url <String>
[-ProxySettings <ProxySettings>]
[-AddToExplorer <SwitchParameter>]
Connect-Site-Url <String>
-Credential <PSCredential>[-AllowConnectionFallback <SwitchParameter>]
[-ProxySettings <ProxySettings>][-AddToExplorer <SwitchParameter>]
Connect-Site-Url <String>
-UserName <String>
-Password <SecureString>[-AllowConnectionFallback <SwitchParameter>]
[-ProxySettings <ProxySettings>]
[-AddToExplorer <SwitchParameter>]
Connect-Site-Url <String>
-Browser <SwitchParameter>[-DisableSSO <SwitchParameter>][-AllowConnectionFallback <SwitchParameter>]
[-ProxySettings <ProxySettings>]
[-AddToExplorer <SwitchParameter>]
Connect-Site-Url <String>
-UseCredentialsFrom <Site>[-AllowConnectionFallback <SwitchParameter>]
[-AddToExplorer <SwitchParameter>]

Parameters

-AddToExplorer <SwitchParameter>

Adds the connection to the Sharegate Explorer.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-AllowConnectionFallback <SwitchParameter>

Allows ShareGate to search for connections options by going up the hierarchy if it can't connect to the specified URL.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Browser <SwitchParameter>

Use browser authentication.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Browser

Aliases

None

-Credential <PSCredential>

Specifies the credentials.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Credential

Aliases

None

-DisableSSO <SwitchParameter>

Disables the auto-login feature in order to connect to a Microsoft 365 site with another user account.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Browser

Aliases

None

-Password <SecureString>

Specifies the password. Use single quotation marks (') to pass the string to the command exactly as you type it.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Manual

Aliases

None

-ProxySettings <ProxySettings>

Sets the proxy settings to connect to the SharePoint site.

Required?

False

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Default, Credential, Manual, Browser

Aliases

None

-Url <String>

Sets the URL of the SharePoint site.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-UseCredentialsFrom <ConnectionEntity>

Use credentials from another conection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

UseCredentialsFrom

Aliases

None

-UserName <String>

Specifies the username.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Manual

Aliases

None

Did this answer your question?