Kaseya Community

Powershell Frustration

This question has suggested answer(s)

Hey Guys.

Have a need to Add .net 3.5 feature to Server 2012 and 2012 R2 servers  (Around 30 systems across multiple sites.

(Required for another application I have to install).

If I run the below Elevated Powershell command direct on a system it installs fine:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All

 

But adding to a procedure it does not.

Have tried Execute Powershell and also the 64bit as User and as System,

Have also tried writing to a ps1 file and executing this from the above pre built steps.

All fail.

Could it be due to it needing Elevated Rights?

If so, can I somehow add something to the ps1 file or execute the ps1 file differently?

Thanks.

Randal.

All Replies
  • Are you sure you need to run DISM under Powershell? On the 2008 Server I just tried, it works fine in a normal command-line.

  • Have you tried setting the execution policy to "Unrestricted"?  technet.microsoft.com/.../ee176961.aspx

  • Hi ,

    On 2012 and above DISM is an alias of Add-WindowsFeature cmdlet, so You will need to add the ServerManager module in the session. So, I suggest you to test something like :

    Impo ServerManager ; Add-WindowsFeature -Name NetFX3 -includeSubFeatures:$true

    in the past (before 2012) DISM is a executable for managing the wim image, but they have been removed.

    As I'm at home now and on my mac I can't certify the powershell cmd but that's the way... On 2008 R2 and above you also need to use the 64 bits step to make working the Import-Module as ServerManager is only available on Windows Server as 64 bits cmdlets.

  • Did you ever get this working?   I'm looking to do the same thing.  I've got an application I'm running thru an agent procedure that requires .net 3.5.   I'm trying to have the agent procedure check if it's installed, then if not, install it.   I need it to work on 2008 and 2012.

    Thanks,

    - Marc

  • Ben was right, you don't need to run DISM under PowerShell, the problem I can see with Randal's original DISM command is that it is missing a source.

    DISM is suppose to be able to download the missing files from the internet however I find that this is often a failure point when you attempt to deploy .NET 3.5 to multiple machines. Also having the source in the network or local will increase the speed of your deployment script.

    I was working on a procedure this week to deploy the prerequisites for MS Dynamics NAV Client to Windows 8.1 workstations, one of these prerequisites is MS Charts for .NET 3.5 and it requires .NET 3.5 framework to be installed before you can run the MS Charts installer.

    Note that you have to execute the DISM command with admin user credentials, it wouldn't run as system for me.

    DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"#global:WIN81SOURCE#" /Quiet /NoRestart

    The variable #global:WIN81SOURCE# is the path to the source folder which would look something like this;

    \\[SERVER]\[SHARENAME]\Windows 8.1 x86 PRO OEM\sources\sxs

    or

    D:\sources\sxs

    To create your source you need to extract the installation media to a network share or you could mount the ISO locally on the target computer.

    You can also test if .NET 3.5 feature is install using the following command;

    DISM /Online /Get-FeatureInfo /Featurename:NetFx3

    Just for in case somebody says that DISM might be different for Windows Server 2012;

    Here is a MSDN article on how to install .NET 3.5 for Windows 8 and 8.1

    msdn.microsoft.com/.../hh506443%28v=vs.110%29.aspx

  • Yeah, I think you're right HardKnoX. I've seen .NET 3.5 have issues installing manually from Server Manager more than once.

  • HardKnoX has it, we have had the best luck with this when pointing to the sources\sxs location. In one case we used Kaseya to deploy  a temp copy of the SXS folder to deploy to several systems.