Issue with Writing Logs to File Using the 'Invoke PowerShell' Activity in UiPath

Hi everyone,
@Yoichi
I am trying to write logs to a file when using the “Invoke PowerShell” activity, but I have not been successful so far.

$logFilePath = "E:\Test\log.txt"
$FolderPath = "E:\UiPath"

Start-Transcript -Path $logFilePath

cd -Path $FolderPath
php test.php --src $FileName --type $FileType


Stop-Transcript


image

Is there a way to do it?
Thanks in advance,

1 Like

@Tuannna1

Please have a look

Cheers

1 Like

Hi @Tuannna1 ,

Check this below workflow attached,
Uipath_WriteTextFileUsingPowershell.xaml (5.7 KB)

Files Used:
Test.txt (25 Bytes)
Powershell script:

Param(

    [Parameter(Mandatory=$true)] [string]$logFilePath,
    [Parameter(Mandatory=$true)] [string]$textToWrite
	)

Add-Content -Path $logFilePath -Value $textToWrite

image

Parameters Passed:

Hope this helps :slight_smile:

3 Likes

Hi @Tuannna1 ,

Also look into this below link,

1 Like

Any reason for not using append text file activity?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.