問題描述
為跨域的 .NET Framework 靜默安裝創建部署應用程序? (Creating a deployment application for .NET Framework silent install across domain?)
I need to deploy .NET framework 4 to all the domain User computers that run off of a server. I have created a console application that will run automatically from a Login Script that is initated when the users Log on to the domain.
The current code i have is able to link to the install file that is located on the server and run it automatically. However i am unable to run it in quiet mode i.e. using /q. Everytime the install file runs it asks for the User to prompt the install, i.e. 'Click Next' and 'Install'.
My current code looks like this (I have changed the login details and file path for security reasons. But the file is situated on a server and the login details are the main admin account) ‑
Function ConvertToSecureString(ByVal str As String)
Dim password As New SecureString
For Each c As Char In str.ToCharArray
password.AppendChar(c)
Next
Return password
End Function
Sub Main()
Dim securePass As New Security.SecureString()
Dim password As SecureString = ConvertToSecureString("password")
Dim myProcess As New Process()
myProcess.StartInfo.Arguments = "/q"
myProcess.Start("C:\dotNetFx40_Full_x86_x64.exe", "user", password, Nothing)
myProcess.StartInfo.CreateNoWindow = True
End Sub
To my understanding with research, the line: myProcess.StartInfo.Arguments = "/q"
is meant to run the install silently in the background without the user prompt. However it does not work.
‑‑‑‑‑
參考解法
方法 1:
Managed to fix it and make a work around. i was just misplacing the line myProcess.StartInfo.Arguments = "/q"
Instead i just included this into the Process.Start line and got rid of the Process Object. So now i have:
Process.Start("C:\dotNetFx40_Full_x86_x64.exe", "/passive", "user", password, Nothing)
I have changed the "/q" for "/passive" because it shows a progress bar of completion.
Thanks for the advice anyway.
Greg
(by Greg Stratford、Greg Stratford)