start-process

Powershell can't read my variable as start-process file path [duplicate]

拜拜、爱过 提交于 2021-01-29 10:12:57
问题 This question already has an answer here : Problems using local variables in a remote commands (1 answer) Closed last year . I'm trying to cleanup my script and I have ran into this issue. When I run Invoke-Command -ComputerName $Computer -ScriptBlock {Start-Process "c:\temp\openVPN\openvpn-install-2.4.8-I602-Win7.exe" I get no issues but when I set a variable so that script looks like this, $filepath = "c:\temp\openVPN\openvpn-install-2.4.8-I602-Win7.exe" Invoke-Command -ComputerName

Executing a scriptblock via startprocess

家住魔仙堡 提交于 2021-01-27 14:23:30
问题 Would any of you possibly know why this is not working? Start-Process $PSHOME\powershell.exe -ArgumentList "-NoExit -Command & `"{$outvar1 = 4+4; `"out: $outvar1`"}`"" -Wait The ultimate purpose for this is so that i can run a script block as another user with the addition of the -Credential option. But i can not get this simple script block to work yet. Many thanks. Chris. 回答1: Here is somthing that is working: PS C:\> Start-Process $PSHOME\powershell.exe -ArgumentList "-NoExit","-Command `"

Starting .ps1 Script from PowerShell with Parameters and Credentials and getting output using variable

倾然丶 夕夏残阳落幕 提交于 2020-05-22 04:15:31
问题 Hello Stack Community :) I have a simple goal. I'd like to start some PowerShell Script from an another Powershell Script, but there are 3 conditions: I have to pass credentials (the execution connects to a database that has specific user) It has to take some Parameters I'd like to pass the output into a variable There is a similar question Link. But the answer is to use files as a way to communicate between 2 PS Scripts. I just would like to avoid access conflicts. @Update: The Main Script

Starting .ps1 Script from PowerShell with Parameters and Credentials and getting output using variable

倾然丶 夕夏残阳落幕 提交于 2020-05-22 04:15:05
问题 Hello Stack Community :) I have a simple goal. I'd like to start some PowerShell Script from an another Powershell Script, but there are 3 conditions: I have to pass credentials (the execution connects to a database that has specific user) It has to take some Parameters I'd like to pass the output into a variable There is a similar question Link. But the answer is to use files as a way to communicate between 2 PS Scripts. I just would like to avoid access conflicts. @Update: The Main Script

How do I start a windows 7 console with a newly modified system environment

穿精又带淫゛_ 提交于 2020-04-30 06:57:12
问题 I have written a (very simple) little Python script, and I want to be able to distribute it to friends who have no idea what Python is, nor anything about Windows cmd scripts. So, fundamentally I need to install Python on their systems, followed by installing the required libraries for my script, followed by my script (and appropriate start-up links in their desktop). I have no interest in creating some sophisticated install program. So, I have written a very simple, trivial little cmd script

Starting .ps1 Script from PowerShell with Parameters and Credentials and getting output from it

蓝咒 提交于 2020-04-11 18:13:30
问题 I think my problem has a simple solution. But now i'm a bit confused. I have Java Code, that starts 1 Powershell Script. This Powershell Script must start other scripts. Java -> Powershell.ps1 -> Script1.ps1 Script2.ps1 Script3.ps1 Script.... Script1,2,..etc performing multiple tasks and return String Values. I've tried Start-Process, Invoke-Command and Invoke-Expression Assuming script1.ps1 is: $a = 1+2 $a Start-Process would work the best for me but im not getting the output: $arguments =

Starting .ps1 Script from PowerShell with Parameters and Credentials and getting output from it

笑着哭i 提交于 2020-04-11 18:13:17
问题 I think my problem has a simple solution. But now i'm a bit confused. I have Java Code, that starts 1 Powershell Script. This Powershell Script must start other scripts. Java -> Powershell.ps1 -> Script1.ps1 Script2.ps1 Script3.ps1 Script.... Script1,2,..etc performing multiple tasks and return String Values. I've tried Start-Process, Invoke-Command and Invoke-Expression Assuming script1.ps1 is: $a = 1+2 $a Start-Process would work the best for me but im not getting the output: $arguments =

Question about using PowerShell Select-String, exiftool(-k)

强颜欢笑 提交于 2020-03-15 05:48:30
问题 In a PowerShell script I'm trying to filter the output of the exiftool(-k).exe command below, using Select-String . I've tried numerous permutations, but none work, and I always see the unfiltered output. What do I need to do to filter the output of this command? Start-Process -FilePath "C:\PowerShell\exiftool(-k).exe" -ArgumentList test.jpg | Select-String -pattern 'GPS' -SimpleMatch 回答1: The naming is inconvenient. Rename it to exiftool.exe and run it without start-process. rename-item

Question about using PowerShell Select-String, exiftool(-k)

不羁岁月 提交于 2020-03-15 05:44:47
问题 In a PowerShell script I'm trying to filter the output of the exiftool(-k).exe command below, using Select-String . I've tried numerous permutations, but none work, and I always see the unfiltered output. What do I need to do to filter the output of this command? Start-Process -FilePath "C:\PowerShell\exiftool(-k).exe" -ArgumentList test.jpg | Select-String -pattern 'GPS' -SimpleMatch 回答1: The naming is inconvenient. Rename it to exiftool.exe and run it without start-process. rename-item