Jump to content

Recommended Posts

Posted

Hi there, I have been having real issues installing .Net Framework 3.5 (includes .NET 2.0 and 3.0) on our Windows 10 systems.

 

We have been trying to install some software called Kinovea. Once the software is installed, it helpfully brings to my attention that the computer needs .NET framework 3.5. It is able to download and install it which it does, but always returns the following error:

 

errormessage.png

 

This is happening on multiple computers, and the ONLY way I have managed to overcome this issue is to run the following command on an elevated PowerShell window:

dism /online /add-package /packagepath:"\\servername\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab" 

 

This Windows cab file appears to work but only when run through PowerShell.

 

Does anyone have any ideas on how I can apply this .Net framework to all stations in our ICT suite (currently 32)?

 

Any help would be very greatly appreciated!

Posted
Elevated Powershell commands should run from Startup scripts in GP - Computer Configuration/Policies/Windows Settings/Scripts/Startup/Powershell Scripts tab. Not tried running dism with this, but have used it for disabling SMBv1 etc.
  • Thanks 1
Posted
dism.exe /online /enable-feature /all /featurename:NetFX3 /Source:d:\sources\sxs /LimitAccess

 

Thank you both for your posts.

 

@alfatec the line you added in your comment, would I add this as a Group Policy elevated PowerShell command as 3s-gtech suggested? If so, what format would I save the script in? I have never made a PowerShell command to execute over Group Policy before. I am assuming it would be a .ps1?

Posted (edited)
Yup, .ps1. Make sure your execution policy allows it to run too (test it to make sure, should be okay).

 

Thanks for the clarification. Wouldn't be so sure on the power shell execution policy. This is a 2016 server running Ranger 8.... not sure why Ranger is on it, but not really with the times.

 

What would be the best way to check if the policy allows it? I am not on site, can do remote logins via RDC.

 

Could I not save the script like this....

 

 

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted

dism.exe /online /enable-feature /all /featurename:NetFX3 /Source:"\\servername\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab /LimitAccess

 

 

If I run the above from a test system logged in as administrator with an elevated PowerShell window, it comes back with an error saying

Error: 87

The limitaccess option is not recognized in this context.

For more information, refer to the help.

 

If I take off the /LimitAccess it works....

 

PS C:\WINDOWS\system32> dism /online /add-package /packagepath:\\servername\applic$\DotNetFix\microsoft-windows-netfx3-o

ndemand-package.cab

 

Deployment Image Servicing and Management tool

Version: 10.0.16299.15

 

Image Version: 10.0.16299.15

 

Processing 1 of 1 - Adding package Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~~10.0.15063.0

[==========================100.0%==========================]

The operation completed successfully.

PS C:\WINDOWS\system32>

Edited by talksr
Posted
If the version without /LimitAccess works, use that ;)

 

Ok, have put it on a policy, bounced the test system after gupdate /force, and it took a while to log in.

What can I look for in Computer Management>Windows Logs to see if it was a success or not?

Posted
Should show up under Application logs I think. You say 'log on' - don't try it as a login script as it won't work; needs to be a startup script to have sufficient privileges.
Posted
Should show up under Application logs I think. You say 'log on' - don't try it as a login script as it won't work; needs to be a startup script to have sufficient privileges.

 

Ok, makes sense. I put it under Windows Settings>Scripts (Startup/Shutdown)>Startup>PowerShell Scripts

 

So it should be in the correct place.

 

Is there any way I can easily check if it has been installed? I have some systems which I know don't have it. It may be easier to bounce them and then see if they have it on them after they boot up.

Posted

/LimitAccess is only for when specifying the /Source switch isn’t it?

 

I also had issue with this once as dism wouldn’t work as a start up script as needed to be run in users context

  • Thanks 1
Posted
/LimitAccess is only for when specifying the /Source switch isn’t it?

 

I also had issue with this once as dism wouldn’t work as a start up script as needed to be run in users context

 

Hi there, I have tried, but it seems this is not working.

The Group Policy is going through, I have verified this with gpreport /h

gpresult.PNG

 

However, when I attempt the run the software, it is saying the .Net is not there. I have manually run the PowerShell script on a system, bounced it and the software works so I know it can't be the actual command.

 

This is where and how I have added the script to Group Policy (this is currently an enforced policy):

gpolicy.PNG

 

This is the configuration of that policy:

GPConfig.PNG

 

These are the edit script options:

EditScript.PNG

 

And this is what is in the actual script:

PSScript.PNG

 

Any help or suggestions would be great. I am wondering if what 3s-gtech's suggestion of execution policy issues may be causing this problem?

Posted (edited)

Interestingly, if I run the script on PowerShell ISE on any system, I get the following:

ISE ERROR.PNG

 

I tried changing the script to this to get around the execution policy, but same error again:

 

 

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

dism /online /add-package /packagepath:\\fty-sr-001\applic$\DotNetFix\microsoft-windows-netfx3-o

ndemand-package.cab

Set-ExecutionPolicy Undefined

Edited by talksr
Posted (edited)
And this is what is in the actual script:

[ATTACH=CONFIG]46605[/ATTACH]

 

Any help or suggestions would be great. I am wondering if what 3s-gtech's suggestion of execution policy issues may be causing this problem?

 

Just making sure... that's 1 line of code right? And not 2 as shown.

 

It should be:

 

dism /online /add-package /packagepath:\\fty-sr-001\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab

 

Update... although looking at mine... I have it as:

 

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\SERVERHERE\SHARE$\W10-sxs"

 

With microsoft-windows-netfx3-ondemand-package.cab in the \\SERVERHERE\SHARE$\W10-sxs folder

Edited by DJ-1701
Posted
Just making sure... that's 1 line of code right? And not 2 as shown.

 

It should be:

 

dism /online /add-package /packagepath:\\fty-sr-001\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab

 

Yup, it seems to be squeezing it onto two, but it is just one in the script.

Posted
Yup, it seems to be squeezing it onto two, but it is just one in the script.

 

Try...

 

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix"

 

That's the format my one is in.

Posted
Try...

 

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix"

 

That's the format my one is in.

 

Frustratingly, same problem again.

 

I used your version of the script:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab"

 

And I get the following error o the ISE:

PS Microsoft.PowerShell.Core\FileSystem::\\fty-sr-001\applic$\DotNetFix> \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1

File \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1 cannot be loaded because running scripts is disabled on

this system. For more information, see about_Execution_Policies at

https:/go.microsoft.com/fwlink/?LinkID=135170.

+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : UnauthorizedAccess

 

I have tried restarting the machine to see if it worked, but no, same as before, it has not gone on.

Posted
Frustratingly, same problem again.

 

I used your version of the script:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix\microsoft-windows-netfx3-ondemand-package.cab"

 

And I get the following error o the ISE:

PS Microsoft.PowerShell.Core\FileSystem::\\fty-sr-001\applic$\DotNetFix> \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1

File \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1 cannot be loaded because running scripts is disabled on

this system. For more information, see about_Execution_Policies at

https:/go.microsoft.com/fwlink/?LinkID=135170.

+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : UnauthorizedAccess

 

I have tried restarting the machine to see if it worked, but no, same as before, it has not gone on.

 

Don’t specify the .cab file. The source should point to the folder only.

  • Thanks 1
Posted
THIS ^^^

:)

 

Thanks, I must have missed that earlier. :) Have made the changes, but still getting the same error again:

 

 

PS Microsoft.PowerShell.Core\FileSystem::\\fty-sr-001\applic$\DotNetFix> \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1

File \\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1 cannot be loaded because running scripts is disabled on

this system. For more information, see about_Execution_Policies at

https:/go.microsoft.com/fwlink/?LinkID=135170.

+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : UnauthorizedAccess

 

This was the new line of code in the script:

 

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix"

Posted (edited)

Looks like you have unsigned powershell scripts disabled... from a command prompt (yes, command prompt) type:

powershell.exe –ExecutionPolicy Bypass "\\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1"

 

IIRC... Startup powershell scripts in GPOs will run regardless.

Edited by DJ-1701
  • Thanks 1
Posted
Looks like you have unsigned powershell scripts disabled... from a command prompt (yes, command prompt) type:

powershell.exe –ExecutionPolicy Bypass "\\fty-sr-001\applic$\DotNetFix\DotNetFix.ps1"

 

IIRC... Startup powershell scripts in GPOs will run regardless.

 

Thanks, that has worked perfectly on my test machine and now Kinovea works on my test computer.

 

The question now is how can I apply this to all computers in the ICT suite?

Posted

Well I would update the code so it doesn't re-run if already installed to something like

 

If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5"))

{

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix"

}

 

Then in a GPO under a Machine Startup Policy add the script to the PowerShell section and once the machines are rebooted, they should install the update (as long as the machines have access to the share ;)).

  • Thanks 1
Posted
Well I would update the code so it doesn't re-run if already installed to something like

 

If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5"))

{

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:"\\fty-sr-001\applic$\DotNetFix"

}

 

Then in a GPO under a Machine Startup Policy add the script to the PowerShell section and once the machines are rebooted, they should install the update (as long as the machines have access to the share ;)).

 

Ok thank you, very helpful.

Would I still make the script a .ps1 file?

Posted
Ok thank you, very helpful.

Would I still make the script a .ps1 file?

 

Yeah, still save it as a ps1 file, the coding I added is a native PowerShell if statement. :)

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...