Start-Transcript in Userprofile\My Documents

P

Personne

Hi,

I'm trying to save all my Powershell Transcripts to a sub-folder of My
Documents like c:\Documents and Settings\myname\My Documents
\PowershellTranscripts\

I'm trying this
$p= "$env:UserProfile\My Documents\PowerShellTranscripts"
Start-Transaction -path $p

But I got this error message
Start-Transaction : A parameter cannot be found that matches parameter
name 'path'.
At line:1 char:24
+ Start-Transaction -path <<<< $p
+ CategoryInfo : InvalidArgument: (:) [Start-
Transaction], ParameterBindingException
+ FullyQualifiedErrorId :
NamedParameterNotFound,Microsoft.PowerShell.Commands.StartTransactionCommand
 

My Computer

L

Larry__Weiss

One thing I see is that $p is a string that represents a folder, not a file.

You have to specify a particular file's name to write the transcript into.

Here's what I include in my profile.ps1 to automatically create a
transcript of my PowerShell sessions:

$global:TRANSCRIPT = "$env:UserProfile\My
Documents\WindowsPowerShell\Transcripts\PSLOG_{0:dd-MM-yyyy}.txt" -f
(Get-Date)
Start-Transcript -Append

I got the idea from this article:
http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2010/05/11/going-back-in-time.aspx

- Larry


On 5/21/2010 12:30 PM, Personne wrote:

> Hi,
>
> I'm trying to save all my Powershell Transcripts to a sub-folder of My
> Documents like c:\Documents and Settings\myname\My Documents
> \PowershellTranscripts\
>
> I'm trying this
> $p= "$env:UserProfile\My Documents\PowerShellTranscripts"
> Start-Transaction -path $p
>
> But I got this error message
> Start-Transaction : A parameter cannot be found that matches parameter
> name 'path'.
> At line:1 char:24
> + Start-Transaction -path<<<< $p
> + CategoryInfo : InvalidArgument: (:) [Start-
> Transaction], ParameterBindingException
> + FullyQualifiedErrorId :
> NamedParameterNotFound,Microsoft.PowerShell.Commands.StartTransactionCommand
 

My Computer

P

Personne

I agree with you, but when I run just Start-transcript with no
parameter it does create a new file automatically like
PowerShell_transcript.20100521102901.txt

Seems the path option force me to manage the filename then

Thank
 

My Computer

L

Larry__Weiss

I think you are correct.

From the help text for Start-Transcript

-Path <string>
Specifies a location for the transcript file. Enter a path
to a .txt file. Wildcards are not permitted.

If you do not specify a path, Start-Transcript uses the path
in the value of the $Transcript global variable. If you have
not created this variable, Start-Transcript stores the transcripts
in the $Home\My Documents directory as
\PowerShell_transcript.<time-stamp>.txt files.

If any of the directories in the path do not exist,
the command fails.

- Larry


On 5/21/2010 1:18 PM, Personne wrote:

> I agree with you, but when I run just Start-transcript with no
> parameter it does create a new file automatically like
> PowerShell_transcript.20100521102901.txt
>
> Seems the path option force me to manage the filename then
>
> Thank
 

My Computer

Top