Author Posts

April 22, 2015 at 2:36 pm

I have a script that when it runs it calls several functions, I've added a new one to do an additional check and the function is not getting a chance to complete so I can see it's return value before going on to the next one...


		Foreach ($EvidSet in $EvidenceList)
		{
			# Verify case data does not exist before creating the case
			$VerifyCaseData = NuixCaseFiles_Copy-Move-Verify $ServerInstance $ProjectDBName $EvidSet $LogsDirectory "VerifyCaseData" "CaseData-Exist" "$PsScriptPath\Functions" -Verbose
			Write-Verbose -message "Case Data Exists: $VerifyCaseData"
                       ###################### THE ABOVE FUNCTION IS WHAT IS BEING SKIPPED BASICALLY, I SEE IT ATTEMPT TO RUN, BUT THE NEXT FUNCTION BEGINS BEFORE i CAN GET THE VERBOSE OUTPUT ############
			
			# Get search available license servers available in the pool, then assign first available if license tests as OK
			$QueryResult = Get-QueryOutput -ServerInstance 'HLPROJD01' -DatabaseName 'AdminDB' -QueryText "SELECT * FROM   [ADMIN].[NuixLicenseConnectionStringGet](1, '$HostNuixVersion');"
			$NewResults = $QueryResult  | Select-object  -ExpandProperty  ServerName
			$LicenseServernames = $NewResults.Split(',')
			$NUIXLicenseServername = Get-NuixLicenseServer -ServerName $LicenseServernames -HostNuixVersion $HostNuixVersion -Verbose
			Write-Verbose -Message " Available License Servers`: $NUIXLicenseServername"
			
			$ParamList = @{
			'PsScriptPath' = "$PsScriptPath\Functions";
			'ServerInstance' = ($ProjConnString.ServerName);
			'DatabaseName' = ($ProjConnString.DatabaseName);
			'EvidenceSet' = $EvidSet;
			'InstalledNuixVersion' = "$HostNuixVersion";
			'NuixApplication' = "$NuixConsoleApp";
			'SessionNum' = $SessionNum;
			'SettingCategory' = "3E7C559A-FC2F-46BF-8282-77945231BA89";
			'NuixOperation' = 'Processing';
			'LogsDirectory' = $LogsDirectory; 
			'TempDirectory' = $TempDirectory;			
			## Added parameter for Nuix License work
			'NUIXLicenseServerName' = $NUIXLicenseServerName }
			
			$AuditTotals = RunNuixOperation @ParamList -Verbose

			$AuditResults = $AuditResults + $AuditTotals
			
			# Copy Case files to the Network
			$MoveToNetwork = NuixCaseFiles_Copy-Move-Verify $ServerInstance $ProjectDBName $EvidSet $LogsDirectory "CaseCreate" "ToNetwork" "$PsScriptPath\Functions" -Verbose
			Write-Verbose -message "Move to Network: $MoveToNetwork"
			
		}

Any ideas why??

April 22, 2015 at 5:12 pm

Write-Verbose does not write to the verbose stream unless $VerbosePreference is changed to 'Continue' or your above snip is from an advanced function which implements [cmdletbinding()] and you have provided -verbose.
To make Write-Verbose always write the verbose stream you must also pass it -Verbose

Write-Verbose -message "Case Data Exists: $VerifyCaseData" -Verbose

April 22, 2015 at 7:44 pm

good catch...thanks...it takes another set of eyes lol