Pragyan93
Pragyan93

Reputation: 721

Is there a way to create a Custom Cloud Foundry Buildpack to run Powershell script?

I am working on a project which requires me to update the HKEY_LOCAL_MACHINE in registry with the path of properties file in a Cloud Foundry Windows container?

So far I have tried to update the HKLM using a dotNet application but that is failing since there is no admin privilege for the application running in the container.

I am trying to think of an alternate solution wherein I can update the HKLM registry key using PowerShell script through a custom buildpack. So, is there a way to create a customer Cloud Foundry Buildpack to run the Powershell script?

Upvotes: 0

Views: 314

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

Is there a way to create a Custom Cloud Foundry Buildpack to run Powershell script?

Yes. By default, the buildpack is going to run batch scripts, but you can very easily call Powershell from there. Take a look at the HWC buildpack, which is doing just that.

@echo off
powershell.exe -ExecutionPolicy Unrestricted %~dp0\detect.ps1 %1

https://github.com/cloudfoundry/hwc-buildpack/tree/master/bin

Upvotes: 1

Related Questions