09 May 2013 @ 10:09 AM 

This morning I was contacted by an IT Pro asking me if I could write some PowerShell code to enable and disable MSI logging.
He both wanted to use it from a command line and needed it to be part of a big troubleshooting script he’s working on; so reusable code.

First up is a function to enable the MSI logging:

function Enable-MSILogging
{
  if((Test-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Name "Logging" ) -eq $False)
  {
    New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Force
  }
  Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Name "Logging" -Value "voicewarmupx" -Force
}

Next is a function to disable the MSI logging:

function Disable-MSILogging
{
  if(Test-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Name "Logging")
  {
    Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Name "Logging" -Force
  }
}

As you can see I’m simply using the registry to enable/disable it.
I’m currently writing some other functions that I’ll post in the near future.

Update: Shay Levy contacted me stating that I’m using Test-ItemProperty and that doesn’t exist. He’s correct since it’s part of my personal toolkit. So I’ve decided to share it with you here.

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 09 May 2013 @ 11:33 AM

EmailPermalinkComments (0)
Tags
 08 May 2013 @ 9:08 AM 

Some time ago I got asked how one could find if a network interface card (NIC) is configured to register itself in DNS.
In the GUI it’s a checkbox, a little hidden and you have to click a bit to find it.
The intention was to do an inventory of the environment to see which servers were properly configured.

So, PowerShell to the resque yet again :-)

$NIC = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "True"}
$NIC.FullDNSRegistrationEnabled

This works for PowerShell v1 and v2 but in v3 you can do this with a simple oneliner:

(Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "True"}).FullDNSRegistrationEnabled

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 08 May 2013 @ 09:08 AM

EmailPermalinkComments (6)
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 251
  • Comments » 430
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.