Facter: Windows: Nothing returned from dir command

asked 2015-05-13 17:45:37 -0500

r0b0tAnthony gravatar image

Hi all,

Facter 2.1.0 Puppet 3.7.4 OS: Windows 7

I'm having some weirdness. I've written several windows custom facts and this is by far the weirdest. I want my fact to have a list of all the userprofiles on a system. I did that successfully via the registry initially but that led to erroneous ones that didn't actually exist. So, I decided the simplest was to get the contents of C:\Users. Simplest command out there is dir. Well, I get the info I want when I manually run:

dir C:\Users /B

When I pass that same command to Facter:

Facter::Core::Execution.exec('dir C:\Users /B')

I get nothing. No error messages. Null.

Not sure where I went wrong.

Thanks

edit retag flag offensive close merge delete

Comments

1

Try 'c:\windows\system32\cmd.exe /c dir c:\users /B'

sinned gravatar imagesinned ( 2015-06-12 02:42:24 -0500 )edit