Viewing and Running Windows PowerShell Scripts
Назначение: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1
If you store your Windows PowerShell scripts in the VMM library, you can view, edit, and run the scripts in Library view.
To be able to run a script from the VMM Administrator Console, you must enable scripting in Windows PowerShell on the local computer. By default, scripting is not allowed in Windows PowerShell. For more information, see about_Signing (https://go.microsoft.com/fwlink/?LinkId=119744) in Windows PowerShell About Help Topics, or, type the following cmdlet in Windows PowerShell: Get-Help about_Signing
.
To view or edit a Windows PowerShell script from the VMM library
In Library view, select the script that you want to view.
In the Actions pane, under Script, click View PowerShell script to open the script in Notepad.
If you use Save As to save a new script on the same share, the script will be added to the library during the next library refresh. Give the file a .ps1 file name extension to enable you to run it in the Windows Powershell – Virtual Machine Manager command shell. If you do not want to wait for the next library refresh, use the Refresh share action to perform a manual refresh on the library share.
To run a Windows PowerShell script from the VMM library
In Library view, select the script that you want to run.
In the Actions pane, under Script, click Run PowerShell script to load the script in a Windows PowerShell runspace.
If you are running an unsigned script, at the prompt, type R (Run Once).
См. также
Основные понятия
Using the Windows PowerShell - VMM Command Shell
How to Perform Manual Library Refreshes
Другие ресурсы
How to Add Files to the Library
Configuring the VMM Library
Introduction to Scripting in Virtual Machine Manager
What’s New in VMM 2008 R2 Scripting