Well, it’s a book-book, not necessarily an ebook, and it does answer all those questions. Very briefly, though, you don’t WANT functions using “public” variables. That’s the bad practice.
$INI = '\\hqfs1\users\tantony\PowerShell\CalenderGroup\config.ini'
function test
{
param([string]$ini_path)
$Read_INI = Get-Content $ini_path
Write-Output $Read_INI
}
test -ini_path $INI
Would be more correct. I’ve also emitted the contents to the output pipeline, so the content will now display as the result of your function. Anything written to Output by your function is your function’s actual output.
I’m massively glossing over a lot of important detail here, so I do recommend reading the book, or something similar, so that you understand what and why is happening. And if you’re not familiar with what commands like Get-Content are doing, you might even want to start with “Learn Windows PowerShell in a Month of Lunches.” For example, if you’re not aware that $Read_INI contains a collection of System.String objects, and not just a giant block of text, then you’ll want to begin at the beginning with that book.