I'm trying to output a CSV in the current directory, but in a folder that matches the $ComputerName, which already exists. I'm doing this for a list of machines regularly and rather than manually put them in their folder it would be awesome to do it in the script.
Here is the current code, writing to the script directory.
#writing file to
[Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath
Write-Host ("Saving CSV Files at " + [Environment]::CurrentDirectory + " Named the following.")
Write-Host $PritnersFilename
I've tried adding $ComputerName to various locations and had no luck.
Examples:
Write-Host ("Saving CSV Files at " + [Environment]::CurrentDirectory\$ComputerName + " Named the following.")
Write-Host ("Saving CSV Files at " + [Environment]::(CurrentDirectory\$ComputerName) + " Named the following.")
EDIT: $ComputerName is the variable of the target, not the local host