我对PowerShell非常陌生,我不确定自己做错了什么。它在我的Windows 8电脑上运行良好,但是当我将它发送给其他人(他有Windows 7;为他创建了这个)时,他得到了一个不允许运行脚本错误的允许。Powershell脚本在Windows 8上运行良好,但不在Windows 7上

尝试使用-ExecutionPolicy RemoteSigned但仍然没有运气。

################## 
<# CONFIG START #> 
################## 
#replace the path with your steam path. For example: C:\Program Files (x86)\Steam\Steam.exe 
$steam_path = "C:\Program Files (x86)\Steam\steam.exe" 

#You can change it to Ethernet 1 or Ethernet 2 or Ethernet 3 etc depending on which adapter you want to disable. 
#If you have custom name for them (you can rename them from control panel), have to use that name. 
$adapter_name = "Ethernet 1" 

<# 
What program to run. 
1: Steam Dota 2 
2: Steam CS 
3: Steam CSS 
4: Steam CSGO 
5: Custom Program 1 
6: Custom Program 2 
7: Custom Program 3 
#> 
$game_id = "5" 

<# Custom Program path and arguments#> 
$cp1_path = "C:\Program Files (x86)\counter-strike source\css.exe" 
$cp1_arg = " " 

$cp2_path = "" 
$cp2_arg = " " 

$cp3_path = "" 
$cp2_arg = " " 

$delay = 20 


################ 
<# CONFIG END #> 
################ 


"Checking admin permissions..." 

If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) 
{ 
    "Administrator permissions required." 
    $arguments = '-ExecutionPolicy RemoteSigned -file "' + $myinvocation.mycommand.definition + '"' 
# $arguments 
    Start-Process powershell -Verb runAs -ArgumentList $arguments 
    Break 
} 


"Exiting Steam..." 
Start-Process -FilePath $steam_path -ArgumentList "-shutdown" -Wait:$true 

Start-Sleep -s 2 

"Disabling Network Adapter..." 
Disable-NetAdapter -Name $adapter_name -Confirm:$false 

Start-Sleep -s 5 

"Starting Game..." 

Switch($game_id) 
{ 

    1 
    { 
     Start-Process -filepath "steam://rungameid/570" 
    } 

    2 
    { 
     Start-Process -filepath "steam://rungameid/10" 
    } 

    3 
    { 
     Start-Process -filepath "steam://rungameid/240" 
    } 

    4 
    { 
     Start-Process -filepath "steam://rungameid/730" 
    } 

    5 
    { 
     Start-Process $cp1_path -ArgumentList $cp1_arg 
    } 

    6 
    { 
     Start-Process $cp2_path -ArgumentList $cp2_arg 
    } 

    7 
    { 
     Start-Process $cp3_path -ArgumentList $cp3_arg 
    } 
} 

Start-Sleep -s $delay 

"Enabling Network Adapter..." 
Enable-NetAdapter $adapter_name -Confirm:$false 

exit 

2013-06-02 CvP