my employer has an imanage to netdocuments migration script that removes all imanage components, purges folders and files, deletes registry keys then installs netdocuments components and copies files etc. i have managed to redirect the PSDAT log file to a network share, i am wondering if it is possible to write the machine name in the filename of the log so when its dropped into a network share its easy to search the files by machine name, if not… does anyone know if there is an equivalent of creating a folder by based machine name (and then i can copy the file name there) something similar to say copy-file \sccm\deploymentshare$\NetDocsUpgrade%computername%? any and all help suggestions etc is greatly appreciated. i am by no means a powershell expert i am just someone who can augment existing scripts to get them to do other things. ty for any help.
The Main.ps1 script supports parameter -ReferredLogname to override name of the log file.
If you use Deploy-Application.ps1 to invoke the main script which is the default then change the line
If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
To
If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging -ReferredLogname "logfile name.log"} Else { . $moduleAppDeployToolkitMain -ReferredLogname "logfile name.log"}
If you invoke it directly then you can can just add the parameter.
i ended up adding this line to the end of the install
#Copy LogFiles to SCCM Network Share - Enable this if Logging is required and replace Destination path
New-Folder -Path "\\SCCM\DeploymentShare$\InPlaceUpGrade-LOGS\$envComputerName" -ContinueOnError $True
Copy-File -Path "$envWinDir\Logs\Software\$LogName" -Destination "\\SCCM\DeploymentShare$\InPlaceUpGrade-LOGS\$envComputerName\$LogName" -ContinueOnError $True
You should escape $ with a backtick ` when used as a plain character, to avoid issues. If powershell thinks its a variable it will replace it with its contents or if it doesnt exist with a $null.
Copying the log file might cause it to not have all the lines written in yet before its copied.