Setting Up AdminStudio Module in PowerShell
Edition:Powershell cmdlets are enabled with AdminStudio Enterprise Edition and with Workflow Manager.
AdminStudio Platform functionality is shipped in the form of a PowerShell Module that can be used in PowerShell. The AdminStudio Module can be installed on a machine or can be used temporarily per PowerShell session.
AdminStudio Microsoft .NET 4.0 Requirement
The AdminStudio DLLs are built using .NET 4.0, while PowerShell by default runs in .NET 2.0. To enable PowerShell to load the AdminStudio DLLs, you need to perform the following steps:
To enable PowerShell to load AdminStudio DLLs:
1. | Create a file named PowerShell.exe.config containing the following content: |
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- http://msdn.microsoft.com/en-us/library/w4atty68.aspx -->
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
2. | Copy this file to the C:\Windows\SysWOW64\WindowsPowerShell\v1.0 directory. |
Enabling a Module Per PowerShell Session
To enable a ModuleModule per PowerShell session, use the following cmdlet:
Import-Module-Name [AdminStudioInstallDir]\Common\AdminStudio.Platform.PowerShellExtensions.dll
The following import is needed in any of the PowerShell sessions/scripts:
Import-Module-Name [AdminStudioInstallDir]\Common\AdminStudio.Utilities.dll
Installing the Module on a Machine
To install the AdminStudio Module on a given machine, use the following cmdlet at a PowerShell prompt:
Set-Alias installutil $env:windir\Microsoft.NET\Framework\v4.0.30319\installutil
installutil [AdminStudioInstallDir]\Common\AdminStudio.Platform.PowerShellExtensions.dll
The following import is needed in any of the PowerShell sessions/scripts:
Import-Module-Name [AdminStudioInstallDir]\Common\AdminStudio.Utilities.dll
Running the Invoke-ASPublish Cmdlet
To run the Invoke-ASPublish cmdlet, you need the following import, either in your PowerShell script or the current PowerShell session:
Import-Module-Name [AdminStudioInstallDir]\Common\AdminStudio.SCCM.Integrator.dll
Requirements
The prerequisite includes the following:
• | For the AdminStudio Platform to work properly, PowerShell needs to run under administrator privileges and also needs to be launched with the -STA flag. |
• | AdminStudio's PowerShell Cmdlets will be available for use only on the machines where AdminStudio is installed and licensed with Enterprise Edition. |