Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, June 20, 2017 10:40 AM
I am writing a script that will read, compare and replace a value when it is true or ignore when it is false. The script is running and it says "cmdlet Get-ConfigFile at command pipeline position 1Supply values for the following parameters:BaseFolder: " I have no idea what i must supply and where but I am assuming I must make some changes to the $BaseFolder line or in my config file. Any help will be greatly appreciatedtry
{
$BaseFolder = Split-Path -parent
$MyInvocation.MyCommand.Definition
$ConfigFile = Get-ConfigFile -FileName "myLog.ini"
$IniContent = Get-IniContent -FilePath $ConfigFile
$LogFile = $IniContent.logging.log_file
Set-Logger -LogFile $LogFile
$Global:Logger = New-LogFile
}
catch
{
Write-Error ("Exit the script : `n{0} `n{1} `nException Type = {2} `n{3}" -f
$_.Exception.Message, `
$_.ScriptStackTrace, `
$_.Exception.GetType().FullName, `
$_.ToString())
exit
}
All replies (3)
Tuesday, June 20, 2017 11:30 AM
You've said you want the parent folder. but not what folder to check for.
for example:
$BaseFolder = Split-Path -Parent c:\Testing\tests
Tuesday, June 20, 2017 12:38 PM
try
{
$BaseFolder = Split-Path
-parent $MyInvocation.MyCommand.Definition
$ConfigFile = Get-ConfigFile
-FileName "$BaseFolder\myLog.ini"
$IniContent = Get-IniContent
-FilePath $ConfigFile
$LogFile = $IniContent.logging.log_file
Set-Logger
-LogFile $LogFile
$Global:Logger =
New-LogFile
}
catch
{
Write-Error
("Exit the script : `n{0} `n{1} `nException Type = {2} `n{3}"
-f
$_.Exception.Message,
`
$_.ScriptStackTrace, `
$_.Exception.GetType().FullName,
`
$_.ToString())
exit
}
Wednesday, June 21, 2017 5:15 AM
Hi Breccs,
what is :Get-ConfigFile???
please run get-help get-configfile -full to check the related parameters.
Best regards,
Andy
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].