Jira (FACT-768) Add the option to re-use existing vbscripts to be used for executable facts.

2 views
Skip to first unread message

Tim Purkerson (JIRA)

unread,
Dec 11, 2014, 4:34:27 PM12/11/14
to puppe...@googlegroups.com
Tim Purkerson created an issue
 
Facter / New Feature FACT-768
Add the option to re-use existing vbscripts to be used for executable facts.
Issue Type: New Feature New Feature
Assignee: Eric Sorenson
Components: PE
Created: 2014/12/11 1:34 PM
Priority: Normal Normal
Reporter: Tim Purkerson

User would like to add the option to re-use existing vbscripts to be used for executable facts.

Here is the information from their ticket:

Hi, we like the option to re-use existing vbscripts to be used for executable facts. This is really easy by putting the below in facter/util/parser.rb (mostly a copy of the powershell part). (No we don't want to execute vbscript from batch file just as you don't want that for powershell). Can this functionality be added to the product so the windows agent gets that? Thanks, looking forward to your response.

  1. Executes and parses the key value output of VBScript/Windows Scripting Format scripts
    class VBScriptParser < Base
  2. Returns a hash of facts from vbscript output
    def parse_results
    cscript =
    if File.exists?("# {ENV['SYSTEMROOT']}\\sysnative
    cscript.exe")
    "#{ENV['SYSTEMROOT']}

    \\sysnative
    cscript.exe"
    elsif File.exists?("#

    {ENV['SYSTEMROOT']}\\system32
    cscript.exe")
    "#{ENV['SYSTEMROOT']}

    \\system32
    cscript.exe"
    else
    'cscript.exe'
    end

shell_command = "\"#

{cscript}\" \"#{filename}\""
output = Facter::Core::Execution.exec(shell_command)
KeyValuePairOutputFormat.parse(output)
end
end

register(VBScriptParser) do |filename|
Facter::Util::Config.is_windows? && extension_matches?(filename, %w{vbs wsf}) && File.file?(filename)
end

1 line could be a bit better to not show the cscript banner, so add the //NoLogo:
shell_command = "\"#{cscript}

\" //Nologo \"#

{filename}

\""

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3.7#6337-sha1:2ed701e)
Atlassian logo

Josh Cooper (JIRA)

unread,
Dec 18, 2014, 10:56:06 PM12/18/14
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Component/s: Windows
This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a)
Atlassian logo

Geoff Nichols (JIRA)

unread,
Sep 26, 2016, 6:34:03 PM9/26/16
to puppe...@googlegroups.com
Geoff Nichols updated an issue
Change By: Geoff Nichols
Sprint: AP Triage Windows Facter
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Claudia Petty (Jira)

unread,
Jun 21, 2023, 8:44:04 AM6/21/23
to puppe...@googlegroups.com
Claudia Petty updated an issue
Change By: Claudia Petty
Labels: new-feature
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages