Thanks for clarifying!

I changed it to include the regexp fix:

Get-ItemProperty 
HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | 
where{$_.DisplayName -and $_.displayname -notmatch 'Update'} | 
Select-Object DisplayName, DisplayVersion | ForEach-Object {$factName = 
$_.DisplayName -replace '-', '_'; $version = $_.DisplayVersion; Write-Host 
$factName"="$version}

On Wednesday, June 1, 2016 at 5:18:51 AM UTC+2, Harish Kothuri wrote:
>
> Hello All,
>
> Everything works fine after removing 7-Zip software. Looks like highphen 
> (-) is having a problem in the name. You can also use regex to avoid those.
>
> Thanks
>
> On Wednesday, June 1, 2016 at 1:29:07 AM UTC+5:30, John Ericson wrote:
>>
>> Hi Harish!
>>
>> This fact looks really interesting. I'm interested in doing the same 
>> thing in my environment. Did you solve the problem? And if so, do you care 
>> to share your solution?
>>
>> Regards,
>> John
>>
>> On Monday, May 23, 2016 at 8:08:29 PM UTC+2, Harish Kothuri wrote:
>>>
>>> Hi, 
>>>
>>> I'm trying to create a custom fact to get the installed software using 
>>> powershell command in windows as follows...
>>>
>>>
>>> *PS Command:-* 
>>> Get-ItemProperty 
>>> HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | 
>>> where{$_.DisplayName -and $_.displayname -notmatch 'Update'} | 
>>> Select-Object DisplayName, DisplayVersion | ForEach-Object {Write-Host 
>>> $_.DisplayName"="$_.DisplayVersion}
>>>
>>> *Output:-*
>>> 7-Zip 15.14 = 15.14
>>> ActiveState ActiveTcl 8.4.20.0 = 8.4.20.0
>>> Microsoft .NET Framework 4 Client Profile = 4.0.30319
>>> Microsoft .NET Framework 4 Extended = 4.0.30319
>>> Notepad++ = 6.9.1
>>> Microsoft .NET Framework 4 Extended = 4.0.30319
>>> Puppet = 3.8.7
>>> Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.61030 = 
>>> 11.0.61030.0
>>> Microsoft .NET Framework 4 Client Profile = 4.0.30319
>>> MSXML 4.0 SP2 Parser and SDK = 4.20.9818.0
>>> Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17 = 9.0.30729
>>> VC9.0 SP0 Debug CRT DLLs = 1.0.0
>>> Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030 = 
>>> 11.0.61030
>>> Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030 = 11.0.61030
>>> Microsoft Visual C++ 2010  x86 Redistributable - 10.0.40219 = 10.0.40219
>>> ActivePerl 5.16.3 Build 1603 = 5.16.1603
>>>
>>>
>>> i have created a powershellscript like  getinstalledlist.ps1 with above 
>>> command and placed in facters.d folder. 
>>>
>>> When i run puppet agent -t , i get the following error.
>>>
>>> Error: Could not retrieve catalog from remote server: Error 400 on 
>>> SERVER: Failed to parse inline template: `@7_zip_15_14 . 
>>>
>>>
>>> Can someone help me to get this going?
>>>
>>> Thanks & Regards,
>>> Harish Kothuri
>>>
>>

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1135ea29-ae56-43ee-8709-85d04fd8a598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to