Powershell can't see all files in a directory

2

Im at a loss with this one. I have a script in the Powershell Directory that I cannot see with Powershell. I've navigated to the directory and ran Dir -Force which should show me all files in the directory even if they are hidden.

To ensure that there wasn't something corrupt with the file I have recreated it in ISE and saved a new version of it in the location. When navigating to the directory I can see neither now.

Spoke with the other engineers that we have here and they haven't seen anything like this either. This works on their machines along with our tools server so it appears to be unique to my environment. Any ideas?

Powershell Version

 Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  1770 

Windows version 1607 (OS Build 1493.1770)

enter image description here

Mike Reilly

Posted 2018-12-12T13:46:26.857

Reputation: 41

1Give this a shot, save the script to a different location such as your desktop, and then manually copy that file over to the directory \v1.0 folder. Now go ahead and run the Get-ChildItem command and see if that makes any difference. When you do the manual copy, it should prompt for elevation to copy to that folder. This likely has to do with NTFS ACL permissions and security context when created versus running the file directory query with the PowerShell ISE command. So don't do PowerShell ISE save as and before you copy those over manually, first delete them from there then copy. – Pimp Juice IT – 2018-12-12T14:25:40.947

Thanks PJI. That worked. I saved the file to my desktop and copied it with PS and its now visible to PS and working as expected. You're awesome. – Mike Reilly – 2018-12-12T14:58:18.567

Answers

2

Pimp Juice IT had it right. By saving the file to the desktop and copying it to the directory with Powershell the app can now see it. Everything is running as expected now.

Mike Reilly

Posted 2018-12-12T13:46:26.857

Reputation: 41