簡體   English   中英

使用 PowerShell 從位於其中的 Azure VM 調用文件

[英]To Call a File from Azure VM which resides within it using PowerShell

如何使用 Powershell(本地 ISE)調用文件路徑位於Azure VM中的文件。

在本地計算機上使用 Powershell ISE 並嘗試調用位於 Azure Vm 中的 Ps 文件。

如果您打算在 VM 內運行 .ps1 文件,則可以使用 PowerShell 命令Invoke-AzVMRunCommand 您可以在本地計算機上創建一個腳本,然后將要在 VM 中運行 .ps1 的命令放入該腳本。 例如:

本地計算機中的腳本script.ps1

powershell.exe -f 'C:\script_inside_VM.ps1'    # this is the command that will run inside the VM

使用 PowerShell 命令:

Invoke-AzVMRunCommand -ResourceGroupName groupName -VMName vmName -CommandId 'RunPowerShellScript' -ScriptPath '\path\script.ps1'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM