# Quellordner $SourceFolder = "\\vsql01\FLOWFACT\subcura\Outlook_Signatur\mit_KontaktBild\Signatur" # Zielordner Outlook Signaturen $TargetFolder = "$env:APPDATA\Microsoft\Signatures" Copy-Item -Path "$SourceFolder\*" -Destination $TargetFolder -Recurse -Force $UserName = $env:USERNAME $root = [ADSI]"LDAP://RootDSE" $base = "LDAP://$($root.defaultNamingContext)" $searchRoot = [ADSI]$base $searcher = New-Object System.DirectoryServices.DirectorySearcher($searchRoot) $searcher.Filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$UserName))" $searcher.PageSize = 1 $result = $searcher.FindOne() $props = $result.Properties $DisplayName = $props["displayname"][0] $Position = $props["title"][0] $Telefon = $props["telephonenumber"][0] $Mail = $props["mail"][0] # Signaturpfad $File = "$env:APPDATA\Microsoft\Signatures\WIP-Dresden GmbH.htm" $html = Get-Content $File -Raw $html = $html.Replace("{BEN_NAME}", $DisplayName) $html = $html.Replace("{BEN_POSITION}", $Position) $html = $html.Replace("{BEN_TelefonBuero}", $Telefon) $html = $html.Replace("{BEN_email}", $Mail) Set-Content -Path $File -Value $html -Encoding UTF8