Forum Discussion

Stacy Plante's avatar
Stacy Plante
Copper Contributor
Jul 01, 2021
Solved

Powershell Results to TXT file

Powershell newbie here......looking to run the following but want to send the output to a text file.  

 

Get-SPOSite -Template REDIRECTSITE#0

 

I tried adding | Out-File -FilePath C:\somefilename.txt

 

But that didn't work.  Tells me access to the file path is denied.  

 

Any help would be much appreciated!  Thank you!

  • Likely the issue is you’re writing to a file in the root of your C drive. That’s generally not allowed unless you are running PowerShell as a local admin. Try another location like your user folder.

2 Replies

  • Likely the issue is you’re writing to a file in the root of your C drive. That’s generally not allowed unless you are running PowerShell as a local admin. Try another location like your user folder.
    • Stacy Plante's avatar
      Stacy Plante
      Copper Contributor
      You are exactly right......when I chose a location under my user folder it worked. THANK YOU!

Resources