Exec onlyif registry value is not present

落花浮王杯 提交于 2019-12-01 07:32:38

I found a solution by playing around:

class add_route
{
        exec { "route_to_internal_network":
                command => "C:\Windows\System32\ROUTE.EXE add 192.168.5.254 mask 255.255.255.255 10.5.5.5 -p",
                unless => "C:\Windows\System32\reg.exe query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes /f 192.168.5.254,255.255.255.255,10.5.5.5,1",
        }
}

I'll leave this post up in case anyone else is running into a similar problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!