I’m having an issue where my script will randomly start registering $PSScriptroot as the C:\ drive on my computer. It will work many times as intended, and sometime later seemingly at random it errors out with “cannot find the specified file.”
I am opening the script from C:\Scripts\GETSDC
and it returns:
Get-Content : Cannot find path 'C:\Targets.txt' because it does not exist.
The command that’s throwing the error first in my script is get-content:
$Targets = Get-Content $PSScriptRoot\Targets.txt
Any help would be appreciated. Thanks!