溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何用PowerShell連接微軟云

發(fā)布時(shí)間:2020-06-18 15:35:29 來源:網(wǎng)絡(luò) 閱讀:559 作者:raincity 欄目:系統(tǒng)運(yùn)維

最近有個(gè)需求要用Powershell要看遷移任務(wù)狀態(tài),原因就是微軟O365網(wǎng)頁看狀態(tài)那個(gè)地方不準(zhǔn)確的,你剛建立的任務(wù),十分鐘沒有就說同步完成了。
所以要查看狀態(tài)就必須用PowerShell.
我有一個(gè)腳本,但是執(zhí)行時(shí)總出錯(cuò),翻譯成中文就是腳本執(zhí)行Policy不許可。
第一步:于是我第一步用了一個(gè)命令:
PS C:\WINDOWS\system32> Get-ExecutionPolicy -list

    Scope ExecutionPolicy
    ----- ---------------

MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine RemoteSigned

第二步: 然后我就在想,我要去微軟的云去驗(yàn)證,這個(gè)屬性應(yīng)該是RemoteSigned.當(dāng)時(shí)不是這樣的,于是我就寫了一條命令如下:

PS C:\WINDOWS\system32> Get-ExecutionPolicy -list

    Scope ExecutionPolicy
    ----- ---------------

MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine RemoteSigned

PS C:\WINDOWS\system32> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PS C:\WINDOWS\system32>

第三步,其實(shí)還是不可以,然后我就找到另一個(gè)命令

Unlblock-File -path "CloudServicesShell.ps1" 想法就是把這個(gè)腳本的執(zhí)行權(quán)限去掉。然后神奇的就解決了,腳本就可以執(zhí)行了。

大家肯定想知道那個(gè)腳本代碼是什么吧,因?yàn)橛形覀児镜男畔?,所以不方便外傳,?shí)在想要的,留言吧。

如何用PowerShell連接微軟云

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI