PowerCLI

 View Only
  • 1.  A Newbie Question, Windows Activation Script

    Posted Nov 25, 2013 05:09 PM

    I would like to have a script that will run against my VMs and in the case of Windows Servers identify if they are registered or not.  I've been digging around but I may not be using the correct Google search questions or perhaps it can not be done.  Has anyone here ever written or seen a script that does this?  In the best case I'm hoping to set it up to run daily.

    My problem is that someone on my server team is certain that VMs which were properly registered are becoming unregistered for some reason.  I suspect they just were not registered properly in the beginning.  I don't have empirical data to prove this but I think this script process will not only answer the question but it will also prevent this from being an issue in the future.

    Thanks for reading this whether you have an answer or not.



  • 2.  RE: A Newbie Question, Windows Activation Script

    Posted Nov 25, 2013 06:31 PM

    This activates Windows.

    You can run this inside the guest OS with the Invoke-VMScript cmdlet.

    $computer = Get-Content Env:ComputerName
    $wpaKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

    $wpa = Get-WmiObject -Query "Select * from SoftwareLicensingService" -ComputerName $computer
    $wpa.InstallProductKey($wpaKey)
    $wpa.RefreshLicenseStatus()


  • 3.  RE: A Newbie Question, Windows Activation Script

    Posted Nov 25, 2013 07:06 PM

    How would I go about seeing what the current Activation status is?



  • 4.  RE: A Newbie Question, Windows Activation Script
    Best Answer

    Posted Nov 25, 2013 07:28 PM

    You can do something like this

    $computer = Get-Content Env:ComputerName
    Get-WmiObject -Class SoftwareLicensingProduct -ComputerName $computer |
    select name,licensestatus

    One of the returned products should show a 1 in the licensestatus column



  • 5.  RE: A Newbie Question, Windows Activation Script

    Posted Nov 26, 2013 01:50 PM

    Thank you very much. I appreciate your help.