0
내 스크립트에서 자격 증명을 설정하는 방법은 개발할 때마다 내 사용자와 암호를 계속 입력하는 것을 성가 시게합니다.office 365 Set-Credential
기본적으로 Set-Credential과 같은 기능이 있습니다. 당신이 스크립트 사용할 수 있습니다
내 스크립트에서 자격 증명을 설정하는 방법은 개발할 때마다 내 사용자와 암호를 계속 입력하는 것을 성가 시게합니다.office 365 Set-Credential
기본적으로 Set-Credential과 같은 기능이 있습니다. 당신이 스크립트 사용할 수 있습니다
감사합니다 :이 스크립트를 사용할 수 있습니다
Set-ExecutionPolicy unrestricted
$cred = Get-Credential
$O365 = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic –AllowRedirection
$importcmd = Import-PSSession $O365
$importcmd.ExportedFunctions.Count
또는 - 그런 일 :
$domain=YOUR_DOMAIN
$userName = "[email protected]$domain.onmicrosoft.com" ($domain change to your domain)
$password = "PASSWORD"
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName, $securePassword
Connect-MsolService -Credential $credential
$Cred = Get-Credential
Import-Module MSOnline
Connect-MsolService -Credential $cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
$User = “<[email protected]>”
$Pass = “<password>”
$Cred = New-Object System.Management.Automation.PsCredential($User,(ConvertTo-SecureString $Pass -AsPlainText -Force))
Import-Module MSOnline
Connect-MsolService -Credential $Cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session