I think this might have to do with 32bit versus x64. Try opening an x86 PowerShell console and running the first set of code.
On Tue, Jan 28, 2014 at 8:18 PM, Atse Tewodors <[email protected]>wrote: > Hi, > > I am trying converting a powershell script to puppet and providers. I try > to compile using https://downloads.puppetlabs.com/windows/puppet-3.0.2.msi but > the code executed without windows update setting changed. > > Powershell code -Works fine in powershell > > $Updates = (New-Object -ComObject "Microsoft.Update.AutoUpdate").Settings > > if ($Updates.ReadOnly -eq $True) { > $Updates.ReadOnly = False > $Updates.NotificationLevel = 1 #Disabled > $Updates.Save() > $Updates.Refresh() > } > > else { > $Updates.NotificationLevel = 1 #Disabled > $Updates.Save() > $Updates.Refresh() > } > > > but when i run the below command using > https://downloads.puppetlabs.com/windows/puppet-3.0.2.msi --The > Notification level not updated ??? > > a = %x[ powershell -command " & {($Updates = (New-Object -ComObject > "Microsoft.Update.AutoUpdate").Settings.NotificationLevel)}" ] > b = %x[ powershell -command " & {($Updates = (New-Object -ComObject > "Microsoft.Update.AutoUpdate").Settings.ReadOnly)}" ] > > > if b.delete("\n") != "False" > > %x[ powershell -command " & {($Updates = (New-Object -ComObject > "Microsoft.Update.AutoUpdate").Settings; $Updates.ReadOnly = False)}"] > > end > > > if a.delete("\n").to_i != 1 > > %x[ powershell -command " - < {($Updates = (New-Object -ComObject > "Microsoft.Update.AutoUpdate").Settings ; "$Updates.NotificationLevel = > '$1'" -Force ; $Updates.save()}" ] > > end > > > Any help is appreciated with the above or any other alternative > > > > > -- > 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/106f4ce0-d641-49a6-a555-d1c2a8653d6a%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- Rob Reynolds Developer, Puppet Labs Join us at PuppetConf 2014, September 23-24 in San Francisco - http://bit.ly/pupconf14 Register now and save 40%! Offer expires January 31st. -- 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/CAMJiBK4LdfD1nAnqZTzZxh1XCkrBrw46p9iH0kg-%3D7ja9iKuGQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
