Powershell script and output
good day
i'm new on powershell script (linux user), inherited few windows machine , have windows shares googling around found script display users , last time folder accessed. run script no output
here script
get-childitem -recurse "c:\users\%profilename%\desktop\users.ps1" | ?{ $_.psiscontainer } | select-object fullname,lastwritetime | out-file 'c:\users\%profilename%\desktop\test.log'
hi,
that's because %profilename% doesn't anything.
here's how use environment variables in powershell:
http://ss64.com/ps/syntax-env.html
you don't need test on psiscontainer, use -directory switch of get-childitem.
lastly, not use single quotes if want use variable. single quotes not allow variables expand.
Windows Server > Windows PowerShell
Comments
Post a Comment