Launching: "cscript Start_CoreConfig.wsf"
You'll be asked to confirm every operation
Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful,
this script can potentially harm your computer. Do you want to run
C:\Utility\CoreConfig\CoreConfig.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
To solve this go to CoreConfig installation folder,edit Start_CoreConfig.wsf and substitute:
Function LaunchCoreConfig()
'========================
Dim iRetCode
Dim Temp
'
LaunchCoreConfig = False
'
On Error Resume Next
WshShell.RegWrite"HKLM\Software\Microsoft\Powershell\1\ShellIds
\Microsoft.PowerShell\ExecutionPolicy", "Unrestricted", "REG_SZ"
On Error goto 0
'
WshShell.CurrentDirectory = GlobalFolderPath
iRetCode = WshShell.Run ("C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Minimized -Sta -file CoreConfig.ps1", 1, True)
If iRetCode <> 0 Then
Call Debug("Error: During launch of CoreConfig! ReturnCode:" & iRetCode)
Call WshShell.Popup("Error: During launch of CoreConfig! ReturnCode:" & iRetCode & Vbcrlf & " Please copy source to local drive and try again!" ,0,"Error", 16)
Else
'Okay
LaunchCoreConfig = True
End If
End Function
with
Function LaunchCoreConfig()
'========================
Dim iRetCode
Dim Temp
'
LaunchCoreConfig = False
'
On Error goto 0
'
WshShell.CurrentDirectory = GlobalFolderPath
iRetCode = WshShell.Run ("%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -WindowStyle Minimized -Sta -file CoreConfig.ps1", 1, True)
If iRetCode <> 0 Then
Call Debug("Error: During launch of CoreConfig! ReturnCode:" & iRetCode)
Call WshShell.Popup("Error: During launch of CoreConfig! ReturnCode:" & iRetCode & Vbcrlf & " Please copy source to local drive and try again!" ,0,"Error", 16)
Else
'Okay
LaunchCoreConfig = True
End If
End Function
Explanation:
First of all is not a good solution to set execution policy to unrestricted for all Powershell scripts changing Reg Key:
WshShell.RegWrite"HKLM\Software\Microsoft\Powershell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy", "Unrestricted", "REG_SZ"
Second this doesn't solve the problem.
The idea is to Bypass execution policy for this script... if we trust it, of course.
I do!
Now you can enjoy your CoreConfig
Nessun commento:
Posta un commento