Powershell cannot find path, adding spaces in string


I am working on a Powershell script, it is a simple foreach loop through objects, and the output should be like:

this is coming from a Invoke-SQLQuery into Multiple column row Array
ForEach ($DB in $DBList)

$DB.Name, Path


the output is correct:



so when i run it on PowerShell ISE and add in to use that path, the path for some reason adds spaces in between the path:

Z:\Server1\Data base_001\backup _001.full

exactly like above happens… not sure why, is this something that happens all the time with powershell?

It’s best to run/test scripts in a PowerShell console as ISE does have some limitations/quirks and may offer slightly different behavior like what you’re seeing. ISE is nice for a number of things but not for complete reliability.

If you get different results between a PowerShell console and ISE, go with the PowerShell console. If you want an experience similar to ISE with more reliability, I have found VS Code to match the PowerShell console consistently.

gotya thank you, actually i now used the Powershell console. also I put a .ToString() at the end, and for some reason that fixed it. thanks again for your assistance :slight_smile: