Hi.  What you've listed this is an External Fact (
https://puppet.com/docs/puppet/6.2/external_facts.html#executable-facts-on-windows)
  
So it should be in the directory "facts.d" inside your module.

That directory (lib/facter) is for Custom Facts (
https://puppet.com/docs/puppet/6.2/fact_overview.html) which is Ruby code 
only, not batch or PowerShell.

If you know some ruby, you can convert that batch file into a ruby script.  
I wrote a blog which may help.

https://puppet.com/blog/starting-out-writing-custom-facts-windows

On Thursday, July 11, 2019 at 1:30:35 PM UTC+8, comport3 wrote:
>
> Is there anything else that is needed to have a custom facter fact as a 
> batch file?
>
> cat lib/facter/ssh_hostkey.bat 
> ```
> @ECHO OFF
> for /f "tokens=2" %%a in ('type 
> C:\ProgramData\ssh\ssh_host_ecdsa_key.pub') do (set hostkey=%%a)
> Echo ssh_hostkey=%hostkey%
> ```
>
> Executes fine on the Windows host and returns the expected value, but 
> doesn't show up at all using 'facter -p', 'puppet facts' or 'facter 
> ssh_hostkey'.
>
> What am I missing?
>
> The same command works in PowerShell if that's easier to implement ?
> ```
> get-content C:\ProgramData\ssh\ssh_host_ecdsa_key.pub| 
> ForEach-Object{$_.Split(" ")[1]}
> ```
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a0eaa22b-c52b-4d6e-81a0-ee289ddf1e34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to