logo
down
shadow

Trouble with Expanding $Env:TEMP in start-process MSIEXEC


Trouble with Expanding $Env:TEMP in start-process MSIEXEC

Content Index :

Trouble with Expanding $Env:TEMP in start-process MSIEXEC
Tag : powershell , By : gbodunski
Date : November 25 2020, 01:01 AM

I wish this help you Powershell won't extend anything in a string if you're using single-quoted-ticks instead of double quotes. So change your code to:
Start-Process msiexec -wait -ArgumentList "/i $ENV:Temp\PBIDesktop_x64.msi /qn /norestart ACCEPT_EULA=1" 
> $i = 1
> "Double quotes: $i + $i"
Double quotes: 1 + 1
> 'Single quotes: $i + $i'
Single quotes: $i + $i

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Process.Start filename using %temp%


Tag : chash , By : Ruchi
Date : March 29 2020, 07:55 AM
hope this fix your issue The Process class does not expand strings with environment variables (i.e. %temp%).
If you want to use environment variables to build the FileName property then you'll have to get the environment variables (using the GetEnvironmentVariable method on the Environment class) and perform the substitution yourself, like so:
// Construct the path.
string temp = Environment.GetEnvironmentVariable("temp");
string path = Path.Combine(temp, "SSCERuntime_x86-ENU.msi");

// Launch the process.
Process p = new Process();
p.StartInfo.FileName = path;
p.StartInfo.Arguments = "/passive";
p.Start();
p.StartInfo.FileName = 
    Environment.ExpandEnvironmentVariables(@"%temp%\SSCERuntime_x86-ENU.msi");

process.start from a variable location %temp%


Tag : development , By : Josh Tegart
Date : March 29 2020, 07:55 AM
it fixes the issue I have the program unzipping the file to %temp%\myfolder\ , First set the
Environment.CurrentDirectory = Environment.GetEnvironmentVariable("temp")
' Possible variables include temp, tmp, and windir for examples.
Environment.CurrentDirectory = Environment.GetEnvironmentVariable("temp")
Process.start("myfolder\start.cmd")

PSRemotingTransportException when calling Start-Process "MsiExec.exe" on remote machine


Tag : powershell , By : tanminivan
Date : March 29 2020, 07:55 AM
may help you . The best answer I could find is that my uninstall is resetting IIS, which causes my Powershell Remoting connection to be severed.
This is what I did as a work around:

Powershell Start-Process msiexec on a remote machine not working


Tag : powershell , By : Mark
Date : March 29 2020, 07:55 AM
it helps some times It seems the problem was a combination of how the msi installer was build and the restrictions windows server has towards interactive processes. I ended up using psexec to bypass this problem.

Trouble with process.start()


Tag : .net , By : Hadley
Date : March 29 2020, 07:55 AM
seems to work fine WorkingDirectory isn't the path where the .exe is located, it's the path that will be used as the "current" directory for the application once it starts. By default, it's the same folder as the folder where the .exe is located.
For example, when you open a console window to your project folder and execute a command like msbuild, the working directory is your project folder while the executable's path is always somewhere in the .NET SDK.
process.StartInfo.FileName = Path.Combine(directoryRemote,FileNameRemote)
Related Posts Related QUESTIONS :
  • Formatting output from PowerShell to a csv file
  • How to check if a PowerShell switch parameter is absent or false
  • How do I force a function to return a single element array instead of the contained object?
  • compressed file syntax can be supported across all powershell version
  • Is there a way in Powershell for a boolean parameter to automatically be true if not specified when the function is call
  • New-Partition -DriveLetter Option
  • How to add SAMAccountName to output?
  • How to do looping to rename and read a file using PowerShell?
  • Read CSV file then split the values and create a global variable
  • (Get-Date).ToUniversalTime() convert to string but not change format
  • Adding Extra Headers in CSV
  • New-Mailbox command does not accept the -Equipment argument
  • How do I remove IIS 'server' header from http response using Powershell?
  • Creating Subdirectory With Date As Today(mm-dd-yyyy) in Network Drive
  • My first parameter is not being passed to my function
  • How can I overwrite an existing zip file?
  • How to use double if statement using powershell?
  • Command using either or both -Path parameter and $input?
  • How can I return multiple values from a powershell script to the batch file that is calling it?
  • Sensitive word search with powershell
  • Copy files located in multiple subfolder, using a mildmatch search
  • Replace the text for all files in a Directory
  • How to write a PowerShell script which auto increments a number by 1 every time it's run?
  • new user powershell get-service
  • Removing Parts of a File Name based on a Delimiter
  • How can we transform Date in CSV file using PowerShell scripts
  • How to replace multiple characters (<3) of all the filenames in a folder (and subfolder) using PowerShell
  • Powershell environment variable
  • Removing spaces from a string using Powershell
  • List Filename and current date of all files in a directory
  • PowerShell calling environment variable with another variable
  • Uninstall all software starting with a specific string
  • Set-ADUser does not handle empty or null variables
  • How do I get the data results from Invoke-RestMethod into CSV file?
  • ConvertFrom-String returns symbol not text
  • Get-WinEvent Select time and field within data item of 1
  • Create multiple files with Powershell?
  • I have a folder that contains multiple folders which contain images. I want to filter the images based on dimensions
  • Function not working even though variable looks fine
  • How to specify multiple files in $sourcePath
  • Deleting a specific tag in xml file
  • Suppressing called function/cmdlet's WhatIf output, when that function has no WhatIf parameter
  • Import CSV File to a new Excel Worksheet within an existing Excel Workbook
  • Start-Service cmdlet: get underlying error in case of failure
  • What would the opposite if this office 365 powershell command?
  • How to install the WASP in powershell?
  • change powershell command color
  • How to list all installed, runnable cmdlets in powershell?
  • PowerShell index value of PSObject
  • Powershell Foreach-Object behaves abnormaly on null values
  • My code will not write "No files to process"
  • Get certificates information using powershell
  • How to uninstall dell support assist with powershell?
  • EF6 Add-Migration in PowerShell, outside Visual Studio
  • Not able to rename button base on value
  • Description property dont give back result
  • Using powershell script with different parameters
  • How to get the current script to read off computer names off a txt file located on c:\
  • Powershell check if drive letter exists and if so remove
  • Powershell script to return search results from a list of keywords
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com