Creating a PowerShell based fact to get Drive Letters and Labels

202 views
Skip to first unread message

Ryan Murphy

unread,
Oct 17, 2017, 5:22:20 PM10/17/17
to Puppet Users
So I have the following powershell command that gives me the data I want, but I'm not sure how I can get Puppet to ingest it as a fact.

Get-WMIObject Win32_Volume | Where-Object {$_.DriveType -eq "3" -and $_.Label -ne "System Reserved" } | select Name, Label 

The Output looks like this.
Name                                                                      Label                                                                    
----                                                                      -----                                                                    
E:\                                                                       EVol                                                                     
D:\                                                                       DVol                                                                     
C:\                        

I wanted to get the Drive letters and labels in to a single fact in Puppet so that I could build Nagios disk checks off of them, But I'm not sure how to get the output to a format that Puppet will like.

Any powershell / puppet fact outputs out there able to help?

Jason McMahan

unread,
Oct 18, 2017, 5:26:09 PM10/18/17
to Puppet Users
We use the windows disk facts module at https://forge.puppet.com/dylanratcliffe/windows_disk_facts

That should give you what you want then you can use it within your manifests.

Ryan Murphy

unread,
Oct 20, 2017, 9:51:23 PM10/20/17
to Puppet Users
hmmm... thanks for the suggestion, I wrote something, but I may give that a try.


On Tuesday, October 17, 2017 at 4:22:20 PM UTC-5, Ryan Murphy wrote:
Reply all
Reply to author
Forward
0 new messages