none
Script Detection Method Outlook Signature RRS feed

  • Question

  • Win2088R2+SCCM 2012, client PC Win7x86

    I use Powershell Script Detection Method to test Outlook 2010 Signature

    Script:

    $CompanyName = 'Company'

    $MSWord = New-Object -com word.application

    $EmailOptions = $MSWord.EmailOptions

    $EmailSignature = $EmailOptions.EmailSignature

    $EmailSignatureEntries = $EmailSignature.EmailSignatureEntries

     

    if ($EmailSignature.NewMessageSignature -eq $CompanyName) {}

    else

        {

        $MSWord.Quit()

        exit 1

        }

    if ($EmailSignature.ReplyMessageSignature -eq $CompanyName) {}

    else

        {

        $MSWord.Quit()

        exit 1

        }   

    $MSWord.Quit()

    Write-Host "Successful"

    This script works when run manually!!!

    But if you run through the installation of applications in SCCM - does not work!

    It is interesting that the launch is scheduled on behalf of the user, but the process in Task Manager is displayed only when open "Show processes from all users."

    In Appdistsovery.log error:

    Friday, January 11, 2013 5:57 AM

All replies

  • Lineis not working:

    $EmailSignatureNM=$EmailSignature.NewMessageSignature

    I guess the execution of the script is not in the name of "interactive user", which leads to what that error.

    How to resolve?

    Friday, January 11, 2013 7:38 AM
  • Please paste the whole script here.

    Note that $EmailSignature.NewMessageSignature I think should be $null by default (before creating signature)

    Friday, January 11, 2013 9:15 AM
  • Please paste the whole script here.

    Note that $EmailSignature.NewMessageSignature I think should be $null by default (before creating signature)


    Its whole script!

    $MSWord = New-Object -com word.application

    if ($MSWord.EmailOptions.EmailSignature.NewMessageSignature -eq "TestSignature") {}

    else

        {

        $MSWord.Quit()

        Write-Host "no NewMessageSignature"

        exit 1

        }

    if ($EmailSignature.ReplyMessageSignature -eq $CompanyName) {}

    else

        {

        $MSWord.Quit()

        Write-Host "no ReplyMessageSignature"

        exit 1

        }   

    $MSWord.Quit()

    Write-Host "Successful"

    NO WORK with SCCM ( see up

    In line script execution time out...

    output with error

    Friday, January 11, 2013 9:36 AM
  • By which user are you running this script in SCCM?

    I think it is necessary to check HKCU before:

    041 #Setting registry information for the current user.

    http://proproit.com/activedirectory/outlook-signature/

    Friday, January 11, 2013 11:48 AM
  • Script runs on behalf of my member, as shown in the first picture.

    I wrote a test script:

    Write-Host "Start"

    $ErrorLog="c:\PSLogs\1.txt"

    "Start" | add-content $ErrorLog

    [System.Security.Principal.WindowsIdentity]::GetCurrent().Name

    [System.Security.Principal.WindowsIdentity]::GetCurrent().Name | add-content $ErrorLog

    [Environment]::UserName | add-content $ErrorLog

    (Get-ItemProperty "HKCU:\Software\CWC\Outlook Signature Settings").User

    (Get-ItemProperty "HKCU:\Software\CWC\Outlook Signature Settings").User | add-content $ErrorLog

    $CompanyName = 'Company'

    Write-Host "Create word.application"

    "Create word.application" | add-content $ErrorLog

    $MSWord = New-Object -com word.application

    Write-Host "Test NewMessageSignature"

    "Test NewMessageSignature" | add-content $ErrorLog

    if ($MSWord.EmailOptions.EmailSignature.NewMessageSignature -eq $CompanyName ) {}

    else

        {

        Write-Host "Error NewMessageSignature"

        "Error NewMessageSignature" | add-content $ErrorLog

        $MSWord.Quit()

        exit 1

        }

    Write-Host "Test ReplyMessageSignature"

    if ($MSWord.EmailOptions.EmailSignature.ReplyMessageSignature -eq $CompanyName) {}

    else

        {

        Write-Host "Error ReplyMessageSignature"

        "Error ReplyMessageSignature" | add-content $ErrorLog

        $MSWord.Quit()

        exit 1

        }   

    Write-Host "Successful"

    "Test NewMessageSignature" | add-content $ErrorLog

    $MSWord.Quit()

    Here are the results:

    Start
    NSK\vaylandt.a_adm
    vaylandt.a_adm
    vaylandt.a_adm

    Create word.application
    Test NewMessageSignature

    The problem is clearly in the script runs as SCCM.

    How to troubleshoot the problem?

    Monday, January 14, 2013 5:44 AM
  • Did you ever manage to resolve this ?
    Friday, September 6, 2019 7:19 AM