我正在尝试运行从命令提示符调用PowerShell脚本的.cmd文件,我收到以下错误:
无法加载Management_Install.ps1,因为在此系统上禁用了脚本的执行.
我跑了cmd.exe,当我Management_Install.ps1从PowerShell 运行时,我Get-ExecutionPolicy回来了.
// Powershell的输出
PS C:\ Users\Administrator> get-executionpolicy
无限制
//从DOS输出
C:\ Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scr
ipts> powershell.\ Management_Install.ps1 1
警告:运行x86 PowerShell ...
无法加载文件C:\ Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1,因为在此系统上禁用了脚本的执行.有关详细信息,请参阅"get-help about_signing".
在线:1个字符:25
.\ Management_Install.ps1 <<<< 1
CategoryInfo:NotSpecified:(:) [],PSSecurityException
FullyQualifiedErrorId:RuntimeException
C:\ Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts> pause
按任意键继续 ...
该系统是Windows Server 2008 R2.
我究竟做错了什么?
我在BAT文件中有这一行:
"Example1Server.exe"
Run Code Online (Sandbox Code Playgroud)
我想在管理员模式下执行此操作.如何修改bat代码以管理员身份运行它?
它是否正确?我需要加上报价吗?
runas /user:Administrator invis.vbs Example1Server.exe
Run Code Online (Sandbox Code Playgroud) 去年我一直在运行VMware没有问题,今天我打开它启动我的一个虚拟机并收到错误消息,看屏幕截图.
我确实按照链接执行了步骤,在步骤4中我需要使用"mountvol"安装卷.当我尝试使用mountvol X: \\?\Volume{5593b5bd-0000-0000-0000-c0f373000000}\它安装卷时,我一直说The directory is not empty.我甚至创建了一个2GB的分区,但仍然是相同的消息.
我的问题:
如何安装非空的卷,即使它是?
为什么这个Device/Credential Guard会自动启用它,如何摆脱它或禁用它.
我如何在Windows中运行以下命令:
$ sudo django-admin.py startproject NEW
Run Code Online (Sandbox Code Playgroud)
?
每当我需要运行 powershell 脚本时,它都会抱怨安全性,如果我添加,powershell.exe -nologo -executionpolicy bypass -File .\install.ps1我仍然会得到权限被拒绝的未授权访问异常。我只想运行此安装脚本,在 Windows 上的 powershell 上键入的 sudo 等效项是什么?
是否可以在Windows中通过运行窗口以管理员身份打开新的PowerShell控制台?
我知道只需在运行窗口中输入'powershell'即可启动新的控制台,但是有一个参数可以作为管理员启动吗?
喜欢:
"powershell /runas:Administrator"
Run Code Online (Sandbox Code Playgroud)
或者其他的东西?
PS:我正在使用Windows 10 - 我不知道是否有任何区别.
我需要设置程序安装程序的交付.
该程序有一个program_installer.exe和一个文件夹,我在创建安装程序时无法在安装程序中包含该文件夹.
因此,当用户需要安装程序时,我通过MAIL向他发送BATCH文件
@echo off
if DEFINED PROGRAMFILES(X86) (
SET TOOL_INSTALL_DIR="%PROGRAMFILES(X86)%\myfolder"
) else (
SET TOOL_INSTALL_DIR="%PROGRAMFILES%\myfolder"
)
MKDIR %TOOL_INSTALL_DIR%
copy /y \\rk0012352\Public\lkh5iwwh.m4s %TOOL_INSTALL_DIR%
START %PROGRAMFILES%\program_installer.exe
Run Code Online (Sandbox Code Playgroud)
问题是,当用户执行BATCH并运行COPY命令时,在Windows 7上该命令将失败,因为他没有ADMIN权限.
如何在XP和7上以管理员身份运行该复制命令?
您可能会说:当用户使用INSTALL.BAT获取EMAIl时,他是否可以单击RUN AS ADMINISTRATOR?
答案不幸的是,他们中的大多数人都不会这样做而只是抱怨它不起作用.此外,许多电子邮件客户端,如Outlook将提示"打开""保存"选择面板,大多数用户将直接单击打开(生成无权限错误)
"运行为"命令需要指定机器的管理员名称,我不知道如何在每台计算机上调用管理员用户.
有什么建议吗?
我正在尝试创建 bat 脚本,该脚本可以在正确的工作目录中启动与 bat 文件名称相同的 PowerShell 脚本。
这是我得到的:
@ECHO OFF
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -WorkingDirectory '%~dp0' -Verb RunAs}"
PAUSE
Run Code Online (Sandbox Code Playgroud)
以这种方式传递工作目录不起作用。
如何制作将传递正确工作目录和命令行参数的脚本?
我想找到一种方法来查明进程是否以提升的方式运行或不使用 Powershell。
使用案例:能够以本地域用户的身份以更高的权限运行控制面板任务,例如添加或删除程序。
任何帮助将不胜感激。
#Start add or remove as admin
start-process appwiz.cpl -verb runas
#Check if path exists. Answer is Yes, so process is NOT elevated
get-wmiobject -class win32_process | select-object -properties name, path
Run Code Online (Sandbox Code Playgroud) 我在运行任何 powershell 脚本时遇到以下错误。它仅发生在一台客户端服务器上。我不确定是什么触发了这个命令。
如果我将此注册表项从 RemoteSignedto 更改为 ByPass 错误就会消失。
Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy -Value ByPass
Run Code Online (Sandbox Code Playgroud)
例如,我有下面一行简单的脚本。
Read-Host -Prompt "Hit Enter to exit"
Run Code Online (Sandbox Code Playgroud)
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by
a policy defined at a more specific scope. Due to the override, your shell will retain its current effective
execution policy of RemoteSigned. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".
At line:1 char:46
+ …Run Code Online (Sandbox Code Playgroud) powershell ×6
windows ×6
batch-file ×3
cmd ×3
windows-10 ×2
dos ×1
mount ×1
shell ×1
sudo ×1
vmware ×1