I have a Script that reads a log file and creates a text file with some output taken from the log file.
The script works and it takes the right log file as long as it is on my C:\ drive.
The Original File is located on the network drive called s:\ but if I want to take this log by entering the whole path where the file lives I get the error that >> The Drive wasnt found and that a Drive called S does not exist.
How can I connect to a network drive?
$inVar = Select-String -path C:\Dev\Script\Ldorado.log -pattern "IN:" -WORKS
$inVar = Select-String -path S:\Lic_Debug\Ldorado.log -pattern "IN:" - Does not work!
Thanks for all the Answers - I actually managed it by changing the Path name in \fs01\ because that represents the S:\ and it works. Thanks
Try prepending the path with "FileSystem::" ie -path FileSystem::s:\Lic_Debug\Ldorado.log
This ensures your script uses the FileSystem provider which should correctly recognise the drive.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.