PowerShell の dir (Get-ChildItem) で取得できるのは FileInfo か DirectoryInfo の配列
フォルダかファイルで変わる

PS C:\tmp\ps> mkdir aa
PS C:\tmp\ps> dir

ディレクトリ: C:\tmp\ps

Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2021/03/01 22:56 aa

PS C:\tmp\ps> $aa=(dir)[0]
PS C:\tmp\ps> $aa.gettype()

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True DirectoryInfo System.IO.FileSystemInfo

このインスタンスのプロパティの setter を使って属性や更新日時を変更できる

更新日時を変更

PS C:\tmp\ps> $aa.lastwritetime="2020/01/01"
PS C:\tmp\ps> dir

ディレクトリ: C:\tmp\ps

Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2020/01/01 0:00 aa

隠しファイルにする
(隠しファイルは dir に -Force 付けないと取得できない)

PS C:\tmp\ps> $aa.attributes="h"
PS C:\tmp\ps> dir
PS C:\tmp\ps> dir -force

ディレクトリ: C:\tmp\ps

Mode LastWriteTime Length Name
---- ------------- ------ ----
d--h-- 2020/01/01 0:00 aa