Home / convert bat file to powershell Convert bat file to powershell 05/04/2021 I have a GPO to uninstall/install application. Uninstall is PS manuscript and collection in GPO to run initially. Then following bat file to install the application. however I desire to convert this to PS Script via install status write to log file? then make both in PS.You watching: Convert bat file to powershellMy Bat file ================= echo off if exist "\me02softwareshare\%computername%.log" goto end msiexec /i "\me02softwareshareUserApps_64little bit.msi" /update "\me02softwareshareUserApps_64bit_SU6.msp" /l*vx "\me02softwareshare\%computername%.log" ICSERVERNAME=ic4 /qn :finish ====================================AsWhat you require is to check if a paper exists and also run msiexec if it does not exist. Here is how you have the right to execute that in PowerCovering, note that I updated the %computername% variable to $env:computer which is the PowerShell notation for this setting variable:if (-not (Test-Path "\me02softwareshare$env:computername.log")) msiexec /i "\me02softwareshareUserApps_64little.msi" /update "\me02softwareshareUserApps_64bit_SU6.msp" /l*vx "\me02softwareshare$env:computername.log" ICSERVERNAME=ic4 /qn HI Jaap, Thanks, Also this means create the log for each COMPUTER yet have the right to we appfinish to one log file with computer system name and date? my uninstall manuscript carry out prefer this (Someone assist me to create that)$env:computername,(Get-Date) | Out-File $ServerLog -append $Product | choose DisplayName,LocalPackage,UninstallCode | Out-File $ServerLog -appendAsDepends what you want to log exactly, but if you would certainly choose to compose a solitary line through the computer name and the current day using the day formatting of the computer on which it is executed you can run the following:Well that depends, you need to be able to use msiexec for that objective as lengthy as tright here is no GUI interactivity with your application the code you posted need to work. What isn't functioning for you?Hi Jaap I conserve this as soft.ps1 and also try to install to remote pc yet i gained access denied?PS C:scriptssoftware> Invoke-Command also -ComputerName BENWIN7 -FilePath C:scriptssoftwaresoft.ps1Access to the route '\serversoftwaresharecic4.txt' is denied.See more: Microsoft Surface Pro 3 User Guide Pdf, Microsoft Surface 3 User Manual Pdf Download + CategoryInfo : OpenError: (:) , UnauthorizedAccessException + FullyQualifiedErrorId : FileOpenFaitempt,Microsoft.PowerShell.Commands.OutFileCommand + PSComputerName : BENWIN7This seems to indicate that you perform not have actually the proper perobjectives to take this account. Verify if you can actually access the\serversoftwaresharecic4.txt file. If this is not the case you can need to view the share and also ntfs permissions for this specific file and also fileshare in order to give yourself the appropriate permissions to accessibility cic4.txt.See more: A Newer Version Of Bittorrent Is Already Running Error, Bittorrent Is Already Running ErrorHI Jaap,No i have the full permission and also i can open up the file and add something and also conserve. i just removed the"$env:computername,$(Get-Date)" | Out-Documents -FilePath "\serversoftwaresharecic4.txt" -Appendrun the command also , its run efficiently yet no application was mounted or don't recognize the error?As classiccomputers.info provides cookies to enhance user endure. By using our area you consent out to all cookies in accordance with ourCookie plan.