Jump to content

Recommended Posts

Posted

Hi All, I need to upgrade PARS to the latest version but also need to deploy .Net Framework 4 to enable this to work correctly. Could someone point me in the right direction of deploying Framework 4 (We don't have a WSUS)

 

Thank you.

Posted

Look what I worked on today! It pretty simple VBS to run the install if the PC's name doesn't have a text file in a folder. (I'm pretty new to VBS to all you expects out there tear it apart please, feedback is welcome). If you delete the txt file it should reinstall (If needed, update etc?)

 

On Error Resume Next
'VBS DotNet Install Script - Rob Holmes 2011

'Sets objects
Set objshell = CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Set variables - /////EDIT FROM HERE\\\\
'Get the host name from the PC running the script
pcname =  WshNetwork.ComputerName

'Path to folder where the PC named text file will be created.
dotnetpc = "\\server\REMINST\Applications\DotNet\Installed PCs\" & pcname & ".txt"

'Path to the exe installer, could be used for future versions as well.
dotnetexe = "\\server\REMINST\Applications\DotNet\4.0\dotNetFx40_Full_x86_x64.exe /q /norestart"

'End of variables /////EDIT TO HERE\\\\\
'You shouldn't need to edit below this line

'Check if PC already has DotNet installed from folder on server
If objFSO.FileExists (dotnetpc) Then
'Do nothing, DotNet is installed.
Else
'Installs DotNet	
WshShell.Run(dotnetexe)
'Create file to show PC has had Dotnet installed
objFSO.CreateTextFile dotnetpc
End If

  • Thanks 1
Posted

Hi, Tried your script but can't seem to get the setup file to run, it leaves the text document on the server to say its been installed but it hasn't?

 

Any ideas?

 

Thanks

Posted

Umm, well one problem I did find was it wouldn't wait for the installer to finish before writing the text file, but it should run it even if it doesn't install. You made the change to the EXE location and its somewhere that users can read and exc? Are you running it by GPO startup scripts or just manually?

 

I will try and find away of making the script wait for the installer to finish before writing the file. Maybe some on on here knows. (Maybe this thread would be better in the scripts section?)

  • 5 weeks later...
Posted

Thanks for the script. Modified it slightly to just check for the Dotnet 4 reg key to skip installed PCs.

Can now have this run at startup from GPO and can just apply to container with all staff PC.

 

'VBS DotNet 4 Install Script - Micheal Cross 2011
'Credit to Rob Holmes 2011 [url]http://www.edugeek.net/forums/networks/76186-deploying-net-framework-4-a.html[/url]

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell

'Set path to the exe installer.	
dotnetexe = "\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /q /norestart"
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet	
	WshShell.Run(dotnetexe)
End If

Function KeyExists(key)
   Dim objShell
   'On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

  • Thanks 3
  • 4 weeks later...
Posted (edited)
Thanks for the script. Modified it slightly to just check for the Dotnet 4 reg key to skip installed PCs.

Can now have this run at startup from GPO and can just apply to container with all staff PC.

 

'VBS DotNet 4 Install Script - Micheal Cross 2011
'Credit to Rob Holmes 2011 [url]http://www.edugeek.net/forums/networks/76186-deploying-net-framework-4-a.html[/url]

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell

'Set path to the exe installer.	
dotnetexe = "\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /q /norestart"
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet	
	WshShell.Run(dotnetexe)
End If

Function KeyExists(key)
   Dim objShell
   'On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

 

Hi, i wonder if you can help. I have just got round to testing this out for one of my environments that do not have WSUS in place.

 

During my testing i was receiving errors regarding the registry key. (Error attached)

 

Whilst looking at a few machine i think that the reg path is one step further "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1003\Install" and have highlighted the section in bold.

 

If i amend the script to this path and run it on a machine that has it installed it is correct and does nothing.

 

However if i run this on a machine that DOES require Dot Net 4 i recevie the same error as attached.

 

k1q32x.png

 

Can anyone help, very new to VBS.

Edited by Steve_T
Posted (edited)

Hi Steve,

 

I have noticed a slight error in my code that must have been carried over from testing.

The Function to check the registry key has a line commented out that shouldn't be. If you replace the function with this code it should work.

Function KeyExists(key)
   Dim objShell
   On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

 

EDIT: Looking in my registry I have an "Install" key in both "Full" and "Full\1033" folders so either will work.

Edited by d13373d
  • Thanks 2
Posted

Hello,

 

Trying to make use of your script at the moment, thanks !

 

However cant seem to get it to work :(

 

I have the script set to run at start up but nothings happening, windows displays running start up scripts for 5 seconds then displays the user login box (win xp sp3)

 

If I try running the script while logged on it runs and opens the "open file security warning" box for dotNetFx40_Full_x86_x64.exe with Run or Cancel options that i have to manually select. I was under the understanding the /q switch in the script should stop this ??

 

Any help would be great !

Posted

Isn't it a /s you want? Silent run of exe, My understanding was /Q only mutes echo replies, Not everything? (May be misunderstanding but worth trying it)

 

Steve

Posted

Thanks for the reply. Tired it but did not work :(

 

This is what i need to do, The Open File - Security Warning dialog box is displayed when you try to silently install a hotfix or an update by using a Visual Basic script in Windows XP Service Pack 2

 

Where would i add this code to your script to get it to work ??

 

set oShell= CreateObject("Wscript.Shell")

set oEnv = oShell.Environment("PROCESS")

oEnv("SEE_MASK_NOZONECHECKS") = 1

oShell.Run "c:\ms04-038\WindowsXP-KB834707-x86-enu /quiet /passive /norestart",0,True

oEnv.Remove("SEE_MASK_NOZONECHECKS")

Posted (edited)

Short answer is you don't :p That'd be a different script.

 

But to modify the above script assuming you're using the one I think you are it'd be:

 

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell

'Set path to the exe installer.	
dotnetexe = "\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /quiet /passive /norestart",0,True"
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet
               set oEnv = WshShell.Environment("PROCESS")
               oEnv("SEE_MASK_NOZONECHECKS") = 1

	WshShell.Run(dotnetexe)
               oEnv.Remove("SEE_MASK_NOZONECHECKS") 
End If

Function KeyExists(key)
   Dim objShell
   'On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

 

Think that's right, unless I missed an edit :p (Saying that think I missed one of the "'s on the variable the way you're doing it :p

 

If it does complain, just try it with:

 

wshShell.Run("\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /quiet /passive /norestart",0,True)

 

Instead of the var to see if it does fix it.

 

Steve

Edited by Steve21
  • Thanks 1
Posted

You can extract the MSI required from dotNetfx40_full_x86_x64 by using the /x switch.

 

This will extract the core and extended versions as MSI's - as x86 and x64 msi installers (ie 4 MSI's) - you will need to deploy as appropriate to your target OS.

 

Probably a bit late to be of any use in this case, but perhaps useful for somebody else having this issue.

  • 3 weeks later...
Posted
Short answer is you don't :p That'd be a different script.

 

But to modify the above script assuming you're using the one I think you are it'd be:

 

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell

'Set path to the exe installer.	
dotnetexe = "\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /quiet /passive /norestart",0,True"
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet
               set oEnv = WshShell.Environment("PROCESS")
               oEnv("SEE_MASK_NOZONECHECKS") = 1

	WshShell.Run(dotnetexe)
               oEnv.Remove("SEE_MASK_NOZONECHECKS") 
End If

Function KeyExists(key)
   Dim objShell
   'On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

 

Think that's right, unless I missed an edit :p (Saying that think I missed one of the "'s on the variable the way you're doing it :p

 

If it does complain, just try it with:

 

wshShell.Run("\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /quiet /passive /norestart",0,True)

 

Instead of the var to see if it does fix it.

 

Steve

 

Thanks but It doesnt work. I get an error about the " missing.

 

Can you post the working script? I dont really understand your instructions.

Posted
Thanks but It doesnt work. I get an error about the " missing.

 

Can you post the working script? I dont really understand your instructions.

 

I meant like this, (should work):

 

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell

'Set path to the exe installer.	
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet
               set oEnv = WshShell.Environment("PROCESS")
               oEnv("SEE_MASK_NOZONECHECKS") = 1

	wshShell.Run("\\cpsictserver\netlogon\msi\dotNetFx40_Full_x86_x64.exe /quiet /passive /norestart",0,True)
               oEnv.Remove("SEE_MASK_NOZONECHECKS") 
End If

Function KeyExists(key)
   Dim objShell
   'On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

Posted

I ended up with this

 

Option Explicit

'Declare variables
Dim dotnetexe
Dim WSHShell
Dim oEnv

'Set path to the exe installer.	
dotnetexe = "\\rgnew\packages\dotNetFx40_Full_x86_x64.exe /q /norestart"
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Check if PC already has DotNet installed
If KeyExists("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Install") Then
	'Do nothing, DotNet is installed.
Else
	'Installs DotNet
               set oEnv = WshShell.Environment("PROCESS")
               oEnv("SEE_MASK_NOZONECHECKS") = 1

	WshShell.Run(dotnetexe)
               oEnv.Remove("SEE_MASK_NOZONECHECKS") 
End If

Function KeyExists(key)
   Dim objShell
   On Error Resume Next
   Set objShell = CreateObject("WScript.Shell")
       objShell.RegRead (key)
   Set objShell = Nothing
   If Err = 0 Then KeyExists = True
End Function

 

Seems to work for me.

  • 1 month later...
Posted

incase it any use o anyone (or i lose my pendrive lol) this works for me tested on xp and win7x64 as a startup script (runs on win7 in the background

 

setlocal

 

 

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"

 

if NOT %errorlevel%==1 (goto end)

"\\server\packages$\ms msi\Dotnet4\dotNetFx40_Full_x86_x64.exe" /passive /norestart /showfinalerror

 

:End

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...