Method: Inspec::Resources::VBScript#initialize

Defined in:
lib/resources/vbscript.rb

#initialize(vbscript) ⇒ VBScript

Returns a new instance of VBScript.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/resources/vbscript.rb', line 35

def initialize(vbscript)
  return skip_resource 'The `vbscript` resource is not supported on your OS yet.' unless inspec.os.windows?

  cmd = <<-EOH
$vbscript = @"
#{vbscript}
"@
$filename = [System.IO.Path]::GetTempFileName() + ".vbs"
New-Item $filename -type file -force -value $vbscript | Out-Null
cscript.exe /nologo $filename
Remove-Item $filename | Out-Null
EOH
  super(cmd)
end