I am modifying an exiting powershell script other person wrote.
at the top of the powershell, it looks like this:
[CmdletBinding()]param (
[switch]$isTest
)
$locMod = ""
if ($isTest) {
$locMod = "test"
}
$outloc = '\\remoteserver\sis{0}\Project\OUT' -f $locMod
$output = "$outloc\myfile.csv"
$outlog = "$outloc\mylog.txt"
..........
Now I would like to modify the script to use a local drive:
Instead of using \\remoteserver\sis{0}\Project\OUT but just use : c:\export.
This does not matter it is a test server or prod, for they exist for both.
so I am thinking to change it to:
[CmdletBinding()]
$outloc = 'c:\export'
$output = "$outloc\myfile.csv"
$outlog = "$outloc\mylog.txt"
I don't need to check isTest or not, what should I remove:
I think to remove the following lines in bold, but not sure.
[CmdletBinding()]
param (
[switch]$isTest
)
$locMod = ""
if ($isTest) {
$locMod = "test"
}
$outloc = '\\remoteserver\sis{0}\Project\OUT' -f $locMod
$output = "$outloc\myfile.csv"
$outlog = "$outloc\mylog.txt"
Please advice.
Is still [CmdletBinding()] necessary, can it exist without param() line?
Thanks