Skip to content

@hh /hanging_on_powershell secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
not_if in powershell resource fails
[Wed, 09 May 2012 07:38:58 +1200] DEBUG: Processing powershell[Creating service TEST_SERVICE from C:\Path\To\MyService.exe] on mybox
[Wed, 09 May 2012 07:38:58 +1200] INFO: Processing powershell[Creating service TEST_SERVICE from C:\Path\To\MyService.exe] action run (c line /chef/cache/cookbooks/on_windows/libraries/service.rb)
[Wed, 09 May 2012 07:38:58 +1200] DEBUG: sh(powershell Get-Service "TEST_SERVICE") - hangs
def create_and_start_service(svc_name,svc_path)
powershell "Creating service #{svc_name} from #{svc_path}" do
code "New-Service -name \"#{svc_name}\" -BinaryPathName \"#{svc_path}\""
not_if "powershell Get-Service \"#{svc_name}\""
end
service svc_name do
action :start
end
end
create_and_start_service("TEST_SERVICE","C:\Path\To\MyService.exe")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.