HPE Morpheus Enterprise Software
1856411 Members
2590 Online
104112 Solutions
New Discussion

Power Shell Task execution on Windows Instance

 
AungKT
Regular Advisor

Power Shell Task execution on Windows Instance

Hello Experts,

I provisioned the below Windows Instance Type (Morpheus Image) in Azure Public Cloud. Then Morpheus created a user that was defined under the user profile and I was able to access RDP with that user.

I tried to execute powershell task on that instance to install IIS which used the Get-WindowsFeature cmdlet and Install-WindowsFeature cmdlet. From Morpheus portal, it says not recognized those cmdlet. I was able to use those cmdlets by using the RDP console with that username.

When I check powershell execution user from Morpheus with “whoami powershell command” it shows nt authority\system . is that reason we can’t use those cmdlets from Morpheus? or How we can do that?

And I also noticed, Morpheus defined the AzureAdmin username in the Server RPC setting. I am still not able to install IIS even though I changed the username and password in the RPC setting.

It will be great if you can suggest.

Thanks,
Aung

3 REPLIES 3
cbunge
HPE Pro

Re: Power Shell Task execution on Windows Instance

If you are seeing ntauthority\system, the script is/should be executing over the Morpheus Agent. I would have to see how your task is configured to further analyze.

Please also take a look at this RDS installation. The steps would be very similar to installing IIS.

AungKT
Regular Advisor

Re: Power Shell Task execution on Windows Instance

Thanks for sharing Chris.

I created automation task with the command “Install-WindowsFeature -Name Web-Server -IncludeManagementTools” with resource target type and enable elevated shell.

So, I just provisioned another instance (same image) and kept the default settings of Server, RPC username is AzureAdmin and Morpheus defined the password automatically. And I executed the automation task at server level (not instance level), execution was successful, and the IIS service was installed. The PowerShell execution user was AzureAdmin.

I don’t know why the agent method was used at the instance level of execution, even though I didn’t install agent due to the Morpheus portal being inaccessible from the Azure cloud.

Thanks,
Aung

Not applicable

Re: Power Shell Task execution on Windows Instance

Hi Aung,

you can create a shell task and run the below script
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command {get-windowsfeature}

Alternately you can also create a PowerShell script template and run get-windowsfeature -name web-server

Thanks
Velan