Ask Your Question

Having puppet run powershell script in ruby

asked 2017-12-28 09:47:14 -0600

athlonxl gravatar image

I have a powershell script we are using to create our folders, shares, and there is a register entry for env enablement. My job is to create a ruby script that dos the same so it can be run in puppet. While going over the powershell I notice what was being used in powershell to give us access to some share files. My question being what would be the ruby equivalent in puppet for script portion shown below. or would it be better to create a ruby script in puppet that runs our powershell script.

#Copy Scripts
    Copy-Item -Path "X:\Information Technology\DBA\PowerShell_Scripts\ServerSetup\DW\*.*" -Destination "D:\Scripts\DW"

    if(!(Get-SBShare -Name SIS -ea 0)){
        New-SBShare -Name SIS -Path D:\SIS

    Grant-SbShareAccess -Name SIS -AccountName "Admin\SQLAdmins" -AccessRight Full -Force
    Grant-SbShareAccess -Name SIS -AccountName "administrators" -AccessRight Full -Force
    Revoke-SbShareAccess -Name SIS -AccountName "Everyone" -Force
edit retag flag offensive close merge delete


Ruby programming is not a Puppet issue. You already know Facter::Core::Execution.exec, so use it. Whether there are already proper Ruby bindings to do the same your shell script does, that I can't tell.

Kai Burghardt gravatar imageKai Burghardt ( 2017-12-30 16:16:59 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-31 09:56:59 -0600

Hi, puppet has a provider that enables you to run powershelgl commands via exec.

have a look at powershell provider

cheers Stuart

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-12-28 09:47:14 -0600

Seen: 310 times

Last updated: Dec 31 '17