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.