Sample_CDOTDATA2PW_Setup_Script.ps1
# Setup script for running a script as a Scheduled Task $PWUSername = '_powershelluser_90159' $SecurePasswordPath = 'D:\PSScripts' $SecurePasswordFileName = "securepassword_$PWUSername`_$env:USERNAME`_$env:COMPUTERNAME.txt" $SecurePasswordFile = "$SecurePasswordPath\$SecurePasswordFileName" Save-SecureStringToEncryptedFile -FileName $SecurePasswordFile -Prompt "Enter PW Password for $PWUSername" #region TEST LOGIN IN cdot-pw-04T $Splat_TESTPWLogin = @{ DataSourceName = 'cdot-pw.bentley.com:cdot-pw-04T' UserName = $PWUSername PWFilePathName = $SecurePasswordFile LogFilePathName = "D:\PSScripts\WorkAreaUpdates\Logs\PWLogin.log" } New-CDOTPWLogin @Splat_TESTPWLogin #endregion |