Method: Inspec::Resources::VBScript#initialize

Defined in:
lib/resources/vbscript.rb

#initialize(vbscript) ⇒ VBScript

Returns a new instance of VBScript.



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

def initialize(vbscript)
  return skip_resource 'The `vbscript` resource is not supported on your OS yet.' unless inspec.os.windows?
  @seperator = SecureRandom.uuid
  cmd = "$vbscript = @\"\n\#{vbscript}\nWscript.Stdout.Write \"\#{@seperator}\"\n\"@\n$filename = [System.IO.Path]::GetTempFileName() + \".vbs\"\nNew-Item $filename -type file -force -value $vbscript | Out-Null\ncscript.exe /nologo $filename\nRemove-Item $filename | Out-Null\n"
  super(cmd)
end