以普通用户身份在Windows计算机上无人参与的软件安装

时间:2019-07-02 07:36:17

标签: windows powershell

我想以普通用户身份在Windows计算机上安装软件,这是下面的脚本:

cd C:\Users\scmadmin\Downloads\Auto-Installation
Get-ChildItem -Filter *.exe | ForEach {
   Start-Process $_.Fullname -ArgumentList '/S' -wait
}

我的文件夹中有以下文件(exe)要安装

PS C:\Users\scmadmin\Downloads\Auto-Installation> ls


    Directory: C:\Users\scmadmin\Downloads\Auto-Installation


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         7/1/2019   7:19 PM        1447178 7z1900-x64.exe
-a----        6/24/2019  12:22 AM      567050280 Docker for Windows Installer.exe
-a----        6/30/2019  10:32 PM        1783200 Greenshot-INSTALLER-1.2.10.6-RELEASE.exe
-a----         7/1/2019   7:40 PM        3929368 npp.7.7.1.Installer.x64.exe
-a----        6/23/2019   6:56 PM       44801806 Udeler-Setup-1.7.0-windows-x64.exe
-a----        6/23/2019   6:54 PM       42034704 vlc-3.0.7.1-win64.exe
-a----         7/1/2019   7:18 PM       50266936 VSCodeUserSetup-x64-1.35.1.exe

问题是,当我运行Powershell脚本时,它会产生如下错误,

PS C:\Users\scmadmin\Desktop> .\Install_All.ps1
Start-Process : This command cannot be run due to the error: The operation was canceled by the user.
At C:\Users\scmadmin\Desktop\Install_All.ps1:3 char:4
+    Start-Process $_.Fullname -ArgumentList '/S' -wait
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

.
.
.

问题是,我弹出了我不想要的窗口。我想要Powershell来安装应用程序,最终的目的是让Ansible调用此PowerShell并将其安装在多台计算机上。

如何解决这个问题?我确实尝试过使用-verb runas,但是我已经以普通用户而非管理员的身份完成了此任务。

任何指导将不胜感激。

0 个答案:

没有答案
相关问题