I am in the process of learning how to use Powershell. I am working on a problem where I am supposed to A) Display the files within another folder on the screen in tabular format,B) Create a new text file, and C) put the info displayed from B into the new next file.
I have figured out how to do it all correctly except for the last part, C. The folder is created and is listing each file as it should. However, it isn’t showing Length and LastWriteTime inside of the text file like a tabular format, just the name of each folder.
My code so far is:
Get-ChildItem C:UsersLabAdminDesktopFolder1 | format-table Name, Length, LastWriteTime -AutoSize
New-Item C:UsersLabAdminDesktopFolder1 -Name 'NewFile.txt' -ItemType File
Get-ChildItem C:UsersLabAdminDesktopFolder1 | Set-Content C:UsersLabAdminDesktopFolder1NewFile.txt
Any help would be appreciated.