• PowerShell questions

    Author
    Topic
    #2292585

    I found a command in PS that is JUST what I needed:  start-transcript.

    Now I don’t have to be asking myself…”How was it I did that?”

    Is there any reason I would want to move from Windows PowerShell to PowerShell 7?

    Chuck Billow

    Viewing 4 reply threads
    Author
    Replies
    • #2292616

      Start-Transcript has been in PowerShell since v5 (i.e. Win 7). What is it you want to do in PS7 that you can’t do now?

    • #2292716

      Chuck,

      Here’s my take on your question.

      1. If you’re only using it on Windows and it does all you want, and it probably does, stick with V5.1. Note: V5.1 is frozen, i.e. there is no further development going forward.
      2. If you’re using Windows & Linux, move to V7 (PowerShell Core) as it will work on both with the exception of Windows specific CmdLets. Note: early of Core lacked some of the Windows specific features but that has been remedied in V7.
      3. If you move to V7 you’ll also need to download and learn Visual Studio Code (free) as V6+ has no ISE. That said Visual Studio Code is nice and has some capabilities missing in PowerShell ISE, but it also lacks some functionality of ISE.

      HTH 😎

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #2292788

        Rick, no, it isn’t new — except to me!  This will hopefully help me in having to re-ask the same questions due to my lack of remembering answers already given!

        Chuck Billow

        • #2292791

          RG,

          It seems that (at least now) Windows PS does pretty much what I have needed.  I have looked at Linux, but don’t spend enough time with it to warrant it becoming my reason for the move.

          If MS’s plans are NOT to move away from Windows PS, then I suspect that for my meager purposes Windows PS is then just fine.

          RG, think how much less (Hopefully!) I’ll have to harass you now that I will be able to look back and say “Oh yeah, THAT’S how I was shown to do…” Now that start-transcript is in my PowerShell profile!

          Chuck Billow

          • #2292843

            Chuck,

            Since Microsoft is no longer enhancing Windows Powershell I recommend you strongly consider PS 7. When Microsoft stops enhancements usually end-of-life is announced fairly quickly. Since there are some differences between the two, I think you should put your time and energy into the one that will be around the longest.

            --Joe

    • #2292936

      OK, I was/am trying to control where the transcript file belongs and is created.

      My PS1 file is

      # Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
      Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
      $profile
      Set-Location C:\
      Start-Transcript -Path “C:\Users\OL Man\Documents\WindowsPowerShell\Transcripts\Transcript.txt” -NoClobber.
      Clear-Host

      But if I then start PowerShell and run a command and exit, there is no transcript file.

      If I instead run the Start-Transcript command with no path, the file is created in my Documents folder.

      IS my Start-Transcript file wrong, or is what I am trying to do not feasible?

       

      Chuck Billow

      • #2292942

        Are you running the “Stop-Transcript” command before you exit PowerShell?

        • #2292946

          No.  I just exited.  Without the path stipulation the transcripts were all starting and finishing without anything but opening and exiting PowerShell.

          With the path stipulation there seems to be no file created.

          Chuck Billow

          • This reply was modified 4 years, 8 months ago by CWBillow.
      • #2292949

        Dark stabs here (I am not a user of PowerShell, so please excuse any impertinence) –
        1 – Does the target folder already exist / does PowerShell create a path when needed?
        2 – Is there supposed to be a period following -NoClobber ?
        3 – When I copy the Start-Transcript line, the quotation marks are ‘smart quotes’. But this may be just the way that this site does things, and not what you really have in the file.

        After reading Example 2 here:
        1a – See [ -Path ] comment
        4 – Is [ …\Transcript.txt ] non-existent, or do you delete it between runs?

    • #2292953

      The folder yes, but not the file.  No, I do not believe that there should be, and there is.

      Without the path, PS just creates a new transcript file each time PS runs.

      I very well could be the period!  I’ll try…

      Chuck Billow

    • #2292962

      I went back and double-checked that the period was just my sloppy typing, and it was.

      The problem though is something in how I state the NoClobber.  It works fine without that in there, but does not if I put it in again.

      Chuck Billow

      • #2292967

        From the MS doco.

        If the Transcript0.txt file already exists, the command fails.

        You need to use a timestamp in the transcript file name.

        cheers, Paul

    Viewing 4 reply threads
    Reply To: PowerShell questions

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: