SOLVED

How to update PowerShell script to include extensionattribute2 to $stream.WriteLine

%3CLINGO-SUB%20id%3D%22lingo-sub-3487387%22%20slang%3D%22en-US%22%3EHow%20to%20update%20PowerShell%20script%20to%20include%20extensionattribute2%20to%20%24stream.WriteLine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3487387%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20use%20a%20PowerShell%20script%20to%20manage%20an%20agency%20wide%20email%20signature%20file%20for%20all%20users.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe've%20recently%20added%20pronouns%20(gender)%20to%20extensionattribute2%20using%20ADSI%20Editor.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20is%20the%20specific%20code%20and%20where%20do%20I%20place%20the%20new%20user%20extensionattribute2%20in%20the%20PowerShell%20script%3F%20It%20will%20need%20to%20display%20directly%20following%20after%20the%20DisplayName.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%3CBR%20%2F%3E%23This%20Powershell%20Script%20creates%20Outlook%20signatures%20for%20Active%20Directory%20users%20and%20sets%20it%20as%20their%20default%20at%20logon%3CBR%20%2F%3E%24strName%20%3D%20%24env%3Ausername%3CBR%20%2F%3E%24strFilter%20%3D%20%22(%26amp%3B(objectCategory%3DUser)(samAccountName%3D%24strName))%22%3CBR%20%2F%3E%24objSearcher%20%3D%20New-Object%20System.DirectoryServices.DirectorySearcher%3CBR%20%2F%3E%24objSearcher.Filter%20%3D%20%24strFilter%3CBR%20%2F%3E%24objPath%20%3D%20%24objSearcher.FindOne()%3CBR%20%2F%3E%24objUser%20%3D%20%24objPath.GetDirectoryEntry()%3CBR%20%2F%3E%24strName%20%3D%20%24objUser.DisplayName%3CBR%20%2F%3E%24strTitle%20%3D%20%24objUser.Title%3CBR%20%2F%3E%24strCompany%20%3D%20%24objUser.Company%3CBR%20%2F%3E%24strDepartment%20%3D%20%24objUser.Department%3CBR%20%2F%3E%24strPhone%20%3D%20%24objUser.telephoneNumber%3CBR%20%2F%3E%24strFax%20%3D%20%24objUser.faxnumber%3CBR%20%2F%3E%24strcellPhone%20%3D%20%24objUser.mobile%3CBR%20%2F%3E%24strEmail%20%3D%20%24objUser.emailaddress%3CBR%20%2F%3E%24strwwwHomePage%20%3D%20%22%24(%24user.wWWHomePage)%22%3CBR%20%2F%3E%23above%20strwwwhomepage%20used%20for%20Assitant%20line%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24UserDataPath%20%3D%20%24Env%3Aappdata%3CBR%20%2F%3E%23Signature%20Folder%20Location%3CBR%20%2F%3E%24FolderLocation%20%3D%20%24UserDataPath%20%2B%20'%5C%5CMicrosoft%5C%5Csignatures%5C%5C'%3CBR%20%2F%3E%3CBR%20%2F%3E%23Checks%20for%20existing%20signature%3CBR%20%2F%3E%23%24path%20%3D%20%24FolderLocation%20%2B%20%24strname%20%2B%20'.htm'%3CBR%20%2F%3E%23%20If%20((Test-Path%20-path%20%24path)%20-eq%20%24true)%20%7B%20break%20%7D%3CBR%20%2F%3E%23%20Else%20%7B%3CBR%20%2F%3Emkdir%20%24FolderLocation%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23Sets%20Outlook%20to%20force%20signature%3CBR%20%2F%3ERemove-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5COutlook%5CSetup%5C%20-name%20First-Run%3CBR%20%2F%3ENew-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMailSettings%20-Name%20%22NewSignature%22%20-Value%20%22%24strname%22%20-PropertyType%20%22String%22%3CBR%20%2F%3ENew-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMailSettings%20-Name%20%22ReplySignature%22%20-Value%20%22%24strname%22%20-PropertyType%20%22String%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%23Creates%20HTML%20Signature%3CBR%20%2F%3E%24stream%20%3D%20%5BSystem.IO.StreamWriter%5D%20%22%24FolderLocation%5C%5C%24strName.htm%22%3CBR%20%2F%3E%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%3CTITLE%3ESignature%3C%2FTITLE%3E%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22%60%22text%2Fhtml%3B%22%20charset%3D%22windows-1252%60%22%22%20%2F%26gt%3B%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%23Name%20of%20Employee%3CBR%20%2F%3E%24stream.WriteLine(%22%3CTABLE%20border%3D%22%60'0%60'%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CB%3E%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%22%20%2B%20%24strName%20%2B%20%22%3C%2FSPAN%3E%3C%2FB%3E%3C%2FTD%3E%3C%2FTR%3E%22)%3CBR%20%2F%3E%23Title%20%26amp%3B%20Company%20Name%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3E%22%20%2B%20%24strTitle%20%2B%20%24strCompany%20%2B%20%22%20%7C%20%22%20%2B%20%24strDepartment%20%2B%20%22%3C%2FTD%3E%3C%2FTR%3E%22)%3CBR%20%2F%3E%23NEA%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3ENational%20Endowment%20for%20the%20Arts%3C%2FTD%3E%3C%2FTR%3E%22)%3CBR%20%2F%3E%23Street%20Address%2C%20Room%2C%20City%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3E400%207th%20Street%20SW%20%7C%20Washington%20DC%2020506%3C%2FTD%3E%3C%2FTR%3E%3C%2FSPAN%3E%22)%3CBR%20%2F%3E%23Email%20%26amp%3B%20Telephone%20Numbers%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3E%22%20%2B%20%24strEmail%20%2B%20%22%20%7C%20202-682-%22%20%2B%20%24strPhone%20%2B%20%22%20(p)%20%7C%20%22%20%2B%20%24strFax%20%2B%20%22%3C%2FTD%3E%3C%2FTR%3E%3C%2FSPAN%3E%22)%3CBR%20%2F%3E%23Second%20Line%20for%20Assistant%20for%20Laura%20Callanan%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3E%22%20%2B%20%24strwwwhomepage%20%2B%20%22%3C%2FTD%3E%3C%2FTR%3E%3C%2FSPAN%3E%22)%3CBR%20%2F%3E%23Social%20Media%3CBR%20%2F%3E%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3ELearn%20more%20about%20the%20arts%20in%20your%20community%20at%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.arts.gov%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.arts.gov%3C%2FA%3E'%26gt%3Barts.gov%22)%3CBR%20%2F%3E%23%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3C%2FSPAN%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3ECelebrating%20the%20NEA's%2050th%20Anniversary%20at%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22https%3A%2F%2Fwww.arts.gov%2F50th%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.arts.gov%2F50th%3C%2FA%3E'%26gt%3Barts.gov%2F50th.%3C%2FTD%3E%3C%2FTR%3E%3C%2FSPAN%3E%22)%3CBR%20%2F%3E%23%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%3CTR%3E%3CTD%20nowrap%3D%22%60'nowrap%60'%22%3ETo%20join%20the%20discussion%20on%20how%20art%20works%2C%20visit%20the%20NEA%20at%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.arts.gov%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.arts.gov%3C%2FA%3E'%26gt%3Barts.gov%2C%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.facebook.com%2Fnationalendowmentforthearts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.facebook.com%2Fnationalendowmentforthearts%3C%2FA%3E'%26gt%3BFacebook%2C%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.twitter.com%2Fneaarts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.twitter.com%2Fneaarts%3C%2FA%3E'%26gt%3BTwitter%2C%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.pinterest.com%2Fartsgov%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.pinterest.com%2Fartsgov%3C%2FA%3E'%26gt%3BPinterest%2C%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.itunes.com%2Faffiliates%2Fdownload%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.itunes.com%2Faffiliates%2Fdownload%3C%2FA%3E'%26gt%3BiTunes%2C%20and%20%3CA%20href%3D%22'%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.youtube.com%2Fuser%2FNEAarts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.youtube.com%2Fuser%2FNEAarts%3C%2FA%3E'%26gt%3BYouTube.%3C%2FTD%3E%3C%2FTR%3E%3C%2FSPAN%3E%22)%3CP%3E%3C%2FP%3E%3CP%3E%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%24stream.close()%3C%2FP%3E%3CP%3E%23Creates%20TXT%20Signature%3CBR%20%2F%3E%24stream%20%3D%20%5BSystem.IO.StreamWriter%5D%20%22%24FolderLocation%5C%5C%24strName.txt%22%3CBR%20%2F%3E%24stream.WriteLine(%22%24strName%22)%3CBR%20%2F%3E%23Title%20%26amp%3B%20Company%20Name%3CBR%20%2F%3E%24stream.WriteLine(%22%24strTitle%20%24strCompany%20%7C%20%24strDepartment%20%22)%3CBR%20%2F%3E%23NEA%3CBR%20%2F%3E%24stream.WriteLine(%22National%20Endowment%20for%20the%20Arts%22)%3CBR%20%2F%3E%23Street%20Address%2C%20Room%2C%20City%3CBR%20%2F%3E%24stream.WriteLine(%22400%207th%20Street%20SW%20%7C%20Washington%20DC%2020506%22)%3CBR%20%2F%3E%23Email%20%26amp%3B%20Telephone%20Numbers%3CBR%20%2F%3E%24stream.WriteLine(%22%24strEmail%20%7C%20202-682-%24strPhone%20(p)%20%7C%20%24strFax%22)%3CBR%20%2F%3E%23Social%20Media%3CBR%20%2F%3E%23%24stream.WriteLine(%22To%20join%20the%20discussion%20on%20how%20art%20works%2C%20visit%20the%20NEA%20at%20%3CA%20href%3D%22http%3A%2F%2Fwww.arts.gov%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ewww.arts.gov%3C%2FA%3E%2C%20Facebook%2C%20Twitter%2C%20Pinterest%2C%20iTunes%2C%20and%20YouTube.%22)%3CBR%20%2F%3E%23%24stream.WriteLine(%22In%20celebration%20of%20the%20NEA's%2050th%2C%20we're%20gathering%20stories%20about%20the%20impact%20of%20art%20on%20people's%20lives.%20Click%20here%20to%20share%20your%20story!%22)%3CBR%20%2F%3E%24stream.WriteLine(%22Learn%20more%20about%20the%20arts%20in%20your%20community%20at%20arts.gov%22)%3CBR%20%2F%3E%24stream.WriteLine(%22%3CA%20href%3D%22https%3A%2F%2Fwww.arts.gov%2Fsites%2Fdefault%2Ffiles%2F2018-%2520Horizontal-Logo-white-on-black-with-url.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.arts.gov%2Fsites%2Fdefault%2Ffiles%2F2018-%2520Horizontal-Logo-white-on-black-with-url.png%3C%2FA%3E%22)%3CBR%20%2F%3E%24stream.close()%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3487387%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Active%20Directory%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3492359%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20update%20PowerShell%20script%20to%20include%20extensionattribute2%20to%20%24stream.WriteLine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3492359%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419009%22%20target%3D%22_blank%22%3E%40Christina_B5749%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou'd%20want%20to%20update%20the%20original%20line%20about%20eight%20lines%20down%20from%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24strName%20%3D%20%24objUser.DisplayName%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20this%20(a%20safe%20option%20that%20behaves%20even%20if%20extensionAttribute2%20hasn't%20been%20set)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eif%20(%24objUser.Properties.Contains(%22extensionAttribute2%22)%20-and%20-not%20%5Bstring%5D%3A%3AIsNullOrWhiteSpace(%24objUser.extensionAttribute2%5B0%5D))%0A%7B%0A%20%20%20%20%24strName%20%3D%20%22%24(%24objUser.DisplayName)%20%24(%24objUser.extensionAttribute2%5B0%5D)%22%3B%0A%7D%0Aelse%0A%7B%0A%20%20%20%20%24strName%20%3D%20%24objUser.DisplayName%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%2C%3C%2FP%3E%3CP%3ELain%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3492436%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20update%20PowerShell%20script%20to%20include%20extensionattribute2%20to%20%24stream.WriteLine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3492436%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F314983%22%20target%3D%22_blank%22%3E%40LainRobertson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20add%20the%20if%20statement%20to%20the%20eighth%20line%20of%20the%20script%2C%20the%20below%20errors%20are%20returned.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Emkdir%20%3A%20An%20item%20with%20the%20specified%20name%20C%3A%5CUsers%5Cboldenc%5CAppData%5CRoaming%5CMicrosoft%5Csignatures%5C%20already%20exists.%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A33%20char%3A1%3CBR%20%2F%3E%2B%20mkdir%20%24FolderLocation%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20ResourceExists%3A%20(C%3A%5CUsers%5Cbolden...oft%5Csignatures%5C%3AString)%20%5BNew-Item%5D%2C%20IOException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20DirectoryExist%2CMicrosoft.PowerShell.Commands.NewItemCommand%3CBR%20%2F%3E%3CBR%20%2F%3ERemove-ItemProperty%20%3A%20Cannot%20find%20path%20'HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5COutlook%5CSetup%5C'%20because%20it%20does%20not%20exist.%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A37%20char%3A1%3CBR%20%2F%3E%2B%20Remove-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5COutloo%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20ObjectNotFound%3A%20(HKCU%3A%5CSoftware%5C...%5COutlook%5CSetup%5C%3AString)%20%5BRemove-ItemProperty%5D%2C%20ItemNotFoundException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20PathNotFound%2CMicrosoft.PowerShell.Commands.RemoveItemPropertyCommand%3CBR%20%2F%3E%3CBR%20%2F%3ENew-ItemProperty%20%3A%20Cannot%20find%20path%20'HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMailSettings'%20because%20it%20does%20not%20exist.%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A38%20char%3A1%3CBR%20%2F%3E%2B%20New-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMa%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20ObjectNotFound%3A%20(HKCU%3A%5CSoftware%5C...on%5CMailSettings%3AString)%20%5BNew-ItemProperty%5D%2C%20ItemNotFoundException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20PathNotFound%2CMicrosoft.PowerShell.Commands.NewItemPropertyCommand%3CBR%20%2F%3E%3CBR%20%2F%3ENew-ItemProperty%20%3A%20Cannot%20find%20path%20'HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMailSettings'%20because%20it%20does%20not%20exist.%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A39%20char%3A1%3CBR%20%2F%3E%2B%20New-ItemProperty%20-Path%20HKCU%3A%5CSoftware%5CMicrosoft%5COffice%5C15.0%5CCommon%5CMa%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20ObjectNotFound%3A%20(HKCU%3A%5CSoftware%5C...on%5CMailSettings%3AString)%20%5BNew-ItemProperty%5D%2C%20ItemNotFoundException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20PathNotFound%2CMicrosoft.PowerShell.Commands.NewItemPropertyCommand%3CBR%20%2F%3E%3CBR%20%2F%3ECannot%20convert%20value%20%22C%3A%5CUsers%5Cboldenc%5CAppData%5CRoaming%5C%5CMicrosoft%5C%5Csignatures%5C%5C%5C%5CChristina%20Bolden%20(She%2FHer%2FHers).htm%22%20to%20type%20%22System.IO.StreamWriter%22.%20Error%3A%20%22Could%20not%20find%20a%20part%20of%20the%20path%3CBR%20%2F%3E'C%3A%5CUsers%5Cboldenc%5CAppData%5CRoaming%5CMicrosoft%5Csignatures%5CChristina%20Bolden%20(She%5CHer%5CHers).htm'.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A43%20char%3A1%3CBR%20%2F%3E%2B%20%24stream%20%3D%20%5BSystem.IO.StreamWriter%5D%20%22%24FolderLocation%5C%5C%24strName.htm%22%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20InvalidArgument%3A%20(%3A)%20%5B%5D%2C%20RuntimeException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20InvalidCastConstructorException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A44%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A45%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CTITLE%3ESignature%3C%2FTITLE%3E%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A46%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22%60%22text%2Fhtml%3B%22%20...%3D%22%22%20%2F%26gt%3B%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A47%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A49%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CTABLE%20border%3D%22%60'0%60'%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CB%3E%3CSPAN%20style%3D%22%60%26quot%3BFONT%22%20...%3D%22%22%3E%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A51%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A53%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A55%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A57%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A59%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A61%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A65%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A66%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A67%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3ECannot%20convert%20value%20%22C%3A%5CUsers%5Cboldenc%5CAppData%5CRoaming%5C%5CMicrosoft%5C%5Csignatures%5C%5C%5C%5CChristina%20Bolden%20(She%2FHer%2FHers).txt%22%20to%20type%20%22System.IO.StreamWriter%22.%20Error%3A%20%22Could%20not%20find%20a%20part%20of%20the%20path%3CBR%20%2F%3E'C%3A%5CUsers%5Cboldenc%5CAppData%5CRoaming%5CMicrosoft%5Csignatures%5CChristina%20Bolden%20(She%5CHer%5CHers).txt'.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A71%20char%3A1%3CBR%20%2F%3E%2B%20%24stream%20%3D%20%5BSystem.IO.StreamWriter%5D%20%22%24FolderLocation%5C%5C%24strName.txt%22%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20InvalidArgument%3A%20(%3A)%20%5B%5D%2C%20RuntimeException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20InvalidCastConstructorException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A72%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%24strName%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A74%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%24strTitle%20%24strCompany%20%7C%20%24strDepartment%20%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A76%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22National%20Endowment%20for%20the%20Arts%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A78%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22400%207th%20Street%20SW%20%7C%20Washington%20DC%2020506%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A80%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%24strEmail%20%7C%20202-682-%24strPhone%20(p)%20%7C%20%24strFax%22)%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A84%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22Learn%20more%20about%20the%20arts%20in%20your%20community%20at%20ar%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CBR%20%2F%3E%3CBR%20%2F%3EException%20calling%20%22WriteLine%22%20with%20%221%22%20argument(s)%3A%20%22Cannot%20write%20to%20a%20closed%20TextWriter.%22%3CBR%20%2F%3EAt%20C%3A%5CUsers%5Cboldenc%5COneDrive%20-%20National%20Endowment%20for%20the%20Arts%5Cboldenc%5CDocuments%5CScripts%20-%20email%20signature_Login%5Cnea_email_sig_with_logo_Pronouns.ps1%3A85%20char%3A1%3CBR%20%2F%3E%2B%20%24stream.WriteLine(%22%3CA%20href%3D%22https%3A%2F%2Fwww.arts.gov%2Fsites%2Fdefault%2Ffiles%2F2018-%2520H%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.arts.gov%2Fsites%2Fdefault%2Ffiles%2F2018-%2520H%3C%2FA%3E%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5B%5D%2C%20MethodInvocationException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20ObjectDisposedException%3CP%3E%3C%2FP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FB%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3492459%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20update%20PowerShell%20script%20to%20include%20extensionattribute2%20to%20%24stream.WriteLine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3492459%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1419009%22%20target%3D%22_blank%22%3E%40Christina_B5749%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20makes%20sense.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20variable%20being%20used%2C%20%24strName%2C%20is%20used%20in%20many%20places%2C%20some%20of%20which%20are%20filenames.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20problem%20then%20is%20that%20extensionAttribute2%20contains%20characters%20like%20%22%2F%22%20which%20is%20what's%20causing%20many%20or%20all%20of%20those%20errors%20(I%20didn't%20read%20every%20single%20one.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat's%20unfortunate%2C%20but%20we%20can%20work%20around%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFirstly%2C%20remove%20the%20lines%20I%20have%20you%20before%20and%20put%20the%20script%20back%20to%20the%20way%20it%20was%20-%20just%20so%20we%20know%20we're%20working%20from%20a%20reliable%20starting%20point.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH4%20id%3D%22toc-hId-1153868288%22%20id%3D%22toc-hId-1153093562%22%20id%3D%22toc-hId-1153093562%22%20id%3D%22toc-hId-1153093562%22%3EStep%201%3A%20Create%20a%20new%20variable%20just%20for%20the%20name%20including%20the%20pronouns.%3C%2FH4%3E%3CP%3EAbout%20eight%20lines%20down%2C%20you%20will%20see%20these%20two%20lines%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24strName%20%3D%20%24objUser.DisplayName%0A%24strTitle%20%3D%20%24objUser.Title%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChange%20these%20two%20lines%20to%20look%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24strName%20%3D%20%24objUser.DisplayName%0Aif%20(%24objUser.Properties.Contains(%22extensionAttribute2%22)%20-and%20-not%20%5Bstring%5D%3A%3AIsNullOrWhiteSpace(%24objUser.extensionAttribute2%5B0%5D))%0A%7B%0A%20%20%20%20%24strNameWithPronouns%20%3D%20%22%24(%24objUser.DisplayName)%20%24(%24objUser.extensionAttribute2%5B0%5D)%22%3B%0A%7D%0Aelse%0A%7B%0A%20%20%20%20%24strNameWithPronouns%20%3D%20%24objUser.DisplayName%3B%0A%7D%0A%24strTitle%20%3D%20%24objUser.Title%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH4%20id%3D%22toc-hId--653586175%22%20id%3D%22toc-hId--654360901%22%20id%3D%22toc-hId--654360901%22%20id%3D%22toc-hId--654360901%22%3EStep%202%3A%20Use%20the%20new%20%24strNameWithPronouns%20variable%20further%20down%20to%20set%20the%20Name.%3C%2FH4%3E%3CP%3EFurther%20down%20-%20around%20line%2045%2C%20you%20will%20see%20this%20line%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24stream.WriteLine(%22%3C%2FCODE%3E%3CTABLE%20border%3D%22%60'0%60'%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CB%3E%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%22%20%2B%20%24strName%20%2B%20%22%3C%2FSPAN%3E%3C%2FB%3E%3C%2FTD%3E%3C%2FTR%3E%22)%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChange%20it%20to%20this%2C%20to%20make%20use%20of%20the%20new%20variable%2C%20%22%24strNameWithPronouns%22%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24stream.WriteLine(%22%3C%2FCODE%3E%3CTABLE%20border%3D%22%60'0%60'%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CB%3E%3CSPAN%20style%3D%22%60%26quot%3BFONT-SIZE%3A%22%2011pt%3D%22%22%3E%22%20%2B%20%24strNameWithPronouns%20%2B%20%22%3C%2FSPAN%3E%3C%2FB%3E%3C%2FTD%3E%3C%2FTR%3E%22)%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%2C%3C%2FP%3E%3CP%3ELain%3C%2FP%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FPRE%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3492461%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20update%20PowerShell%20script%20to%20include%20extensionattribute2%20to%20%24stream.WriteLine%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3492461%22%20slang%3D%22en-US%22%3EThat%20worked!%20Thank%20you%20much.%3C%2FLINGO-BODY%3E
Occasional Contributor

We use a PowerShell script to manage an agency wide email signature file for all users.

 

We've recently added pronouns (gender) to extensionattribute2 using ADSI Editor. 

 

What is the specific code and where do I place the new user extensionattribute2 in the PowerShell script? It will need to display directly following after the DisplayName.

 

#############################################################
#This Powershell Script creates Outlook signatures for Active Directory users and sets it as their default at logon
$strName = $env:username
$strFilter = "(&(objectCategory=User)(samAccountName=$strName))"
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.Filter = $strFilter
$objPath = $objSearcher.FindOne()
$objUser = $objPath.GetDirectoryEntry()
$strName = $objUser.DisplayName
$strTitle = $objUser.Title
$strCompany = $objUser.Company
$strDepartment = $objUser.Department
$strPhone = $objUser.telephoneNumber
$strFax = $objUser.faxnumber
$strcellPhone = $objUser.mobile
$strEmail = $objUser.emailaddress
$strwwwHomePage = "$($user.wWWHomePage)"
#above strwwwhomepage used for Assitant line


$UserDataPath = $Env:appdata
#Signature Folder Location
$FolderLocation = $UserDataPath + '\\Microsoft\\signatures\\'

#Checks for existing signature
#$path = $FolderLocation + $strname + '.htm'
# If ((Test-Path -path $path) -eq $true) { break }
# Else {
mkdir $FolderLocation


#Sets Outlook to force signature
Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Outlook\Setup\ -name First-Run
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings -Name "NewSignature" -Value "$strname" -PropertyType "String"
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings -Name "ReplySignature" -Value "$strname" -PropertyType "String"


#Creates HTML Signature
$stream = [System.IO.StreamWriter] "$FolderLocation\\$strName.htm"
$stream.WriteLine("<!DOCTYPE HTML PUBLIC `"-//W3C//DTD HTML 4.0 Transitional//EN`">")
$stream.WriteLine("<HTML><HEAD><TITLE>Signature</TITLE>")
$stream.WriteLine("<META http-equiv=Content-Type content=`"text/html; charset=windows-1252`">")
$stream.WriteLine("<BODY>")
#Name of Employee
$stream.WriteLine("<Table border =`'0`'><tr><td><B><SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`">" + $strName + "</B></SPAN></td></tr>")
#Title & Company Name
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>" + $strTitle + $strCompany + " | " + $strDepartment + "</td></tr>")
#NEA
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>National Endowment for the Arts</td></tr>")
#Street Address, Room, City
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>400 7th Street SW | Washington DC 20506</SPAN></td></tr>")
#Email & Telephone Numbers
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>" + $strEmail + " | 202-682-" + $strPhone + " (p) | " + $strFax + "</SPAN></td></tr>")
#Second Line for Assistant for Laura Callanan
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>" + $strwwwhomepage + "</SPAN></td></tr>")
#Social Media
$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>Learn more about the arts in your community at <a href='http://www.arts.gov'>arts.gov</a>")
#$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>Celebrating the NEA's 50th Anniversary at <a href='https://www.arts.gov/50th'>arts.gov/50th</a>.</SPAN></td></tr>")
#$stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`"><tr><td nowrap=`'nowrap`'>To join the discussion on how art works, visit the NEA at <a href='http://www.arts.gov'>arts.gov</a>, <a href='http://www.facebook.com/nationalendowmentforthearts'>Facebook</a>, <a href='http://www.twitter.com/neaarts'>Twitter</a>, <a href='http://www.pinterest.com/artsgov'>Pinterest</a>, <a href='http://www.itunes.com/affiliates/download'>iTunes</a>, and <a href='http://www.youtube.com/user/NEAarts'>YouTube</a>.</SPAN></td></tr>")

$stream.WriteLine("</BODY>")
$stream.WriteLine("</HTML>")
$stream.WriteLine("</DIV>")
$stream.close()

#Creates TXT Signature
$stream = [System.IO.StreamWriter] "$FolderLocation\\$strName.txt"
$stream.WriteLine("$strName")
#Title & Company Name
$stream.WriteLine("$strTitle $strCompany | $strDepartment ")
#NEA
$stream.WriteLine("National Endowment for the Arts")
#Street Address, Room, City
$stream.WriteLine("400 7th Street SW | Washington DC 20506")
#Email & Telephone Numbers
$stream.WriteLine("$strEmail | 202-682-$strPhone (p) | $strFax")
#Social Media
#$stream.WriteLine("To join the discussion on how art works, visit the NEA at www.arts.gov, Facebook, Twitter, Pinterest, iTunes, and YouTube.")
#$stream.WriteLine("In celebration of the NEA's 50th, we're gathering stories about the impact of art on people's lives. Click here to share your story!")
$stream.WriteLine("Learn more about the arts in your community at arts.gov")
$stream.WriteLine("https://www.arts.gov/sites/default/files/2018-%20Horizontal-Logo-white-on-black-with-url.png")
$stream.close()

4 Replies

@Christina_B5749 

 

You'd want to update the original line about eight lines down from this:

 

$strName = $objUser.DisplayName

 

 

To this (a safe option that behaves even if extensionAttribute2 hasn't been set):

 

if ($objUser.Properties.Contains("extensionAttribute2") -and -not [string]::IsNullOrWhiteSpace($objUser.extensionAttribute2[0]))
{
    $strName = "$($objUser.DisplayName) $($objUser.extensionAttribute2[0])";
}
else
{
    $strName = $objUser.DisplayName;
}

 

 

Cheers,

Lain

@LainRobertson 

 

When I add the if statement to the eighth line of the script, the below errors are returned.

 

mkdir : An item with the specified name C:\Users\boldenc\AppData\Roaming\Microsoft\signatures\ already exists.
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:33 char:1
+ mkdir $FolderLocation
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (C:\Users\bolden...oft\signatures\:String) [New-Item], IOException
+ FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand

Remove-ItemProperty : Cannot find path 'HKCU:\Software\Microsoft\Office\15.0\Outlook\Setup\' because it does not exist.
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:37 char:1
+ Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Outloo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKCU:\Software\...\Outlook\Setup\:String) [Remove-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemPropertyCommand

New-ItemProperty : Cannot find path 'HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings' because it does not exist.
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:38 char:1
+ New-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\Ma ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKCU:\Software\...on\MailSettings:String) [New-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.NewItemPropertyCommand

New-ItemProperty : Cannot find path 'HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings' because it does not exist.
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:39 char:1
+ New-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\Ma ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKCU:\Software\...on\MailSettings:String) [New-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.NewItemPropertyCommand

Cannot convert value "C:\Users\boldenc\AppData\Roaming\\Microsoft\\signatures\\\\Christina Bolden (She/Her/Hers).htm" to type "System.IO.StreamWriter". Error: "Could not find a part of the path
'C:\Users\boldenc\AppData\Roaming\Microsoft\signatures\Christina Bolden (She\Her\Hers).htm'."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:43 char:1
+ $stream = [System.IO.StreamWriter] "$FolderLocation\\$strName.htm"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastConstructorException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:44 char:1
+ $stream.WriteLine("<!DOCTYPE HTML PUBLIC `"-//W3C//DTD HTML 4.0 Trans ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:45 char:1
+ $stream.WriteLine("<HTML><HEAD><TITLE>Signature</TITLE>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:46 char:1
+ $stream.WriteLine("<META http-equiv=Content-Type content=`"text/html; ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:47 char:1
+ $stream.WriteLine("<BODY>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:49 char:1
+ $stream.WriteLine("<Table border =`'0`'><tr><td><B><SPAN style=`"FONT ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:51 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:53 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:55 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:57 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:59 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:61 char:1
+ $stream.WriteLine("<SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:65 char:1
+ $stream.WriteLine("</BODY>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:66 char:1
+ $stream.WriteLine("</HTML>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:67 char:1
+ $stream.WriteLine("</DIV>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Cannot convert value "C:\Users\boldenc\AppData\Roaming\\Microsoft\\signatures\\\\Christina Bolden (She/Her/Hers).txt" to type "System.IO.StreamWriter". Error: "Could not find a part of the path
'C:\Users\boldenc\AppData\Roaming\Microsoft\signatures\Christina Bolden (She\Her\Hers).txt'."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:71 char:1
+ $stream = [System.IO.StreamWriter] "$FolderLocation\\$strName.txt"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastConstructorException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:72 char:1
+ $stream.WriteLine("$strName")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:74 char:1
+ $stream.WriteLine("$strTitle $strCompany | $strDepartment ")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:76 char:1
+ $stream.WriteLine("National Endowment for the Arts")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:78 char:1
+ $stream.WriteLine("400 7th Street SW | Washington DC 20506")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:80 char:1
+ $stream.WriteLine("$strEmail | 202-682-$strPhone (p) | $strFax")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:84 char:1
+ $stream.WriteLine("Learn more about the arts in your community at ar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

Exception calling "WriteLine" with "1" argument(s): "Cannot write to a closed TextWriter."
At C:\Users\boldenc\OneDrive - National Endowment for the Arts\boldenc\Documents\Scripts - email signature_Login\nea_email_sig_with_logo_Pronouns.ps1:85 char:1
+ $stream.WriteLine("https://www.arts.gov/sites/default/files/2018-%20H ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ObjectDisposedException

best response confirmed by Christina_B5749 (Occasional Contributor)
Solution

@Christina_B5749 

 

That makes sense.

 

The variable being used, $strName, is used in many places, some of which are filenames.

 

The problem then is that extensionAttribute2 contains characters like "/" which is what's causing many or all of those errors (I didn't read every single one.)

 

That's unfortunate, but we can work around that.

 

Firstly, remove the lines I have you before and put the script back to the way it was - just so we know we're working from a reliable starting point.

 

Step 1: Create a new variable just for the name including the pronouns.

About eight lines down, you will see these two lines:

 

$strName = $objUser.DisplayName
$strTitle = $objUser.Title

 

 

Change these two lines to look like this:

 

$strName = $objUser.DisplayName
if ($objUser.Properties.Contains("extensionAttribute2") -and -not [string]::IsNullOrWhiteSpace($objUser.extensionAttribute2[0]))
{
    $strNameWithPronouns = "$($objUser.DisplayName) $($objUser.extensionAttribute2[0])";
}
else
{
    $strNameWithPronouns = $objUser.DisplayName;
}
$strTitle = $objUser.Title

 

 

Step 2: Use the new $strNameWithPronouns variable further down to set the Name.

Further down - around line 45, you will see this line:

$stream.WriteLine("<Table border =`'0`'><tr><td><B><SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`">" + $strName + "</B></SPAN></td></tr>")

 

Change it to this, to make use of the new variable, "$strNameWithPronouns":

$stream.WriteLine("<Table border =`'0`'><tr><td><B><SPAN style=`"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: `'Calibri`'`">" + $strNameWithPronouns + "</B></SPAN></td></tr>")

 

Cheers,

Lain