2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
title: About the vbscript Resource
|
2018-02-16 00:28:15 +00:00
|
|
|
platform: windows
|
2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# vbscript
|
|
|
|
|
|
|
|
Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
|
|
|
|
2018-08-09 12:34:49 +00:00
|
|
|
## Availability
|
|
|
|
|
|
|
|
### Installation
|
|
|
|
|
|
|
|
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
|
|
|
|
|
|
### Version
|
|
|
|
|
|
|
|
This resource first became available in v1.0.0 of InSpec.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Syntax
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
A `vbscript` resource block tests the output of a VBScript on the Windows platform:
|
|
|
|
|
2016-11-20 01:37:24 +00:00
|
|
|
describe vbscript('script contents') do
|
2016-09-22 12:43:57 +00:00
|
|
|
its('stdout') { should eq 'output' }
|
|
|
|
end
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
* `'script_name'` is the name of the VBScript to test
|
|
|
|
* `('output')` is the expected output of the VBScript
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Examples
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### Test a VBScript
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
A VBScript file similar to:
|
|
|
|
|
2016-11-20 01:37:24 +00:00
|
|
|
script = <<-EOH
|
2016-09-22 12:43:57 +00:00
|
|
|
WScript.Echo "hello"
|
|
|
|
EOH
|
|
|
|
|
|
|
|
may be tested for multiple lines:
|
|
|
|
|
2016-11-20 01:37:24 +00:00
|
|
|
describe vbscript(script) do
|
2016-09-22 12:43:57 +00:00
|
|
|
its('stdout') { should eq "hello\r\n" }
|
|
|
|
end
|
|
|
|
|
|
|
|
and tested for whitespace removal from standard output:
|
|
|
|
|
2016-11-20 01:37:24 +00:00
|
|
|
describe vbscript(script) do
|
2016-09-22 12:43:57 +00:00
|
|
|
its('strip') { should eq "hello" }
|
|
|
|
end
|
2017-10-03 21:35:10 +00:00
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
## Matchers
|
|
|
|
|
2018-02-16 03:07:18 +00:00
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|