Quantcast
Channel: VMware Communities : All Content - vRealize Automation Tools
Viewing all articles
Browse latest Browse all 9859

Windows 2012 and ServerManager

$
0
0

I'm having a problem with Windows 2012 R2 and ServerManager.  It would seem that what once worked no longer is... and I've not been able to pinpoint why the behaviour has changed.  Here's the code that WAS working;

 

# assumes NET-Framework-Features are already installed... Use the other service definition in AppD to enable this role prior to running this installation.

# this script will install SP 2013 prerequisites and then install SP 2013 itself.

 

write-output "Importing ServerManager Modules..."

Import-Module ServerManager

 

$WindowsFeatures = @(

"Net-Framework-Features",

"Web-Server",

"Web-WebServer",

"Web-Common-Http",

"Web-Static-Content",

"Web-Default-Doc",

"Web-Dir-Browsing",

"Web-Http-Errors",

"Web-App-Dev",

"Web-Asp-Net",

"Web-Net-Ext",

"Web-ISAPI-Ext",

"Web-ISAPI-Filter",

"Web-Health",

"Web-Http-Logging",

"Web-Log-Libraries",

... Long List of Features...

)

 

Write-Host "Installing SP 2013 Prerequisite Features"

 

$error.clear()

$WindowsFeatures | % {

  Write-Host "Enabling Feature: $_"

  Invoke-Expression "Install-WindowsFeature $_ -Source $WINDOWS2012R2PATH"

}

 

if($error.count -ge 1) {

  Write-Host "error when adding windows features. error details are below:"

  Write-Host $error

  exit 1

}

 

#  Use if process to avoid error with capture within vmware framework

Write-Host "LoopbackCheck"

$lsapath = "HKLM:\System\CurrentControlSet\Control\LSA"

$lsachk = "DisableLoopbackCheck"

if (test-path -Path $lsapath ) {  write-host "path does exist"

     $lbc = get-item -Path $lsapath | where-object { $_.property -eq "$lsachk" }

 

     if ($lbc) { write-host "path and property exist"

           $lbcp = Get-ItemProperty -path $lsapath -name $lsachk

           if($lbcp.$lsachk.Equals(1)) { write-host "value is 1 as we want"

                                                   }

           else               { write-host "value in not 1"

                                set-itemproperty -Path $lsapath -Name $lsachk -value 1

                                }

           }

     else { write-host "path exist but property does not"

            New-ItemProperty -path $lsapath -name $lsachk -value 1

            }   

                               } # path does Exist

else                         { write-host "path does not exist so make it all"

                               New-item -Path $lsapath

                               New-ItemProperty -path $lsapath -name $lsachk -value 1

                               }

 

Write-Host "Rebooting"

 

So, here's the problem... When this part of the workflow runs, it cannot find ServerManager.  If I log in and interactively run the script it works flawlessly.

 

So, I tried a much shorter workflow definition... One that does a check to see what modules are loaded, and what the contents of c:\windows\System32\WindowsPowerShell\v1.0\Modules and low and behold there is NO ServerManager directory. I tried copying said directory to a static known location and copying this into the desired location (above), re-ran the full workflow (I had tested that it loaded correctly, and the desired cmdlets were present) and received the error:

    + CategoryInfo          : DeviceError: (localhost:String) [Install-WindowsFeature], Exception

    + FullyQualifiedErrorId : WindowsClient_NotSupported,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommandInstall-WindowsFeature : The target of the specified cmdlet cannot be a Windows client-based operating system.

 

Any suggestions? I've not been able to find anything on this, but the crux of it is when I inject and run the script, the ServerManager PowerShell Module is not present.  If I log in and run it, it is.


Viewing all articles
Browse latest Browse all 9859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>