Help with change to a script.

Where I work, we disable and add information to some AD fields when people leave the office for periods beyond a week.
We have a powershell script that is used to enable the accounts and for many of the fields we clear the information except for 1 field.
I am looking to add to the existing script to modify the description field. I want it to remove all data after the @ character, while keeping all the data before the @ character
Ex: Service Desk @ Away - Training.


You'll have to incorporate this into your script, but I'm glad to supply some code and logic for a single user, case scenario.
$User = 'username'
$Description = Get-ADUser -Identity $User -Properties Description | Select-Object -ExpandProperty Description
If ($Description -match '@') {
Set-ADUser -Identity $User -Description $Description.Split('@')[0]
To remove some of the procedural aspects you could return the description inside the If conditional. This can, however, make much it more difficult to read.
$User = 'username'
If ((Get-ADUser -Identity $User -Properties Description | Select-Object -ExpandProperty Description) -match '@') {
Set-ADUser -Identity $User -Description (Get-ADUser -Identity $User -Properties Description | Select-Object -ExpandProperty Description).Split('@')[0]
What we've accomplished in these examples is to split the description field at the @ sign and then grab the first element, or index [0]. This would be everything to the left of the @ sign. If there's only one @ sign, then element, or index [1] would be everything
to the right of the @ sign. In addition, element [-1] will always be the last, or right-most element. In the case of one @ sign, and therefore two elements, [-1] will be the same as [1].

Similar Messages

  • I need to need help with changing my app store to canada to us but i have 49cents balance can you remove it please

    I need to need help with changing my app store to canada to us but i have 49cents balance can you remove it please

    Contact iTunes Support - http://apple.com/emea/support/itunes/contact.html - and ask them to clear your balance.

  • I need help with changing my verizon vm to the system voicemail

    I need help with changing my verizon vm to the system voicemail

    Deleting the iTunes account is not the solution as you will very likely lose any and all purchases ever made with the account.
    If you cannot find the option on the site, contact iTunes support.

  • [SOLVED] Need a little help with ACPI handler.sh script.

    By using ACPI I'm trying to get my laptop to hibernate at critical power state. So far I've made a few test scripts to test how to do this, with one of these scripts I'm stuck. My scripting skills are not that good to solve it.
    This is the script:
    if [ `awk '{print $3}' /proc/acpi/battery/C1E9/state` == "ok" ]
    then
    logger "battery is ok"
    else
    logger "battery is not ok"
    fi
    If I run the script I get an error (while "battery is not ok" is logged):
    ┌─[~]
    └─> ./test2
    ./test2: line 1: [: too many arguments
    ┌─[~]
    └─>
    When I run the awk-command from the script, I get the following output:
    ┌─[~]
    └─> awk '{print $3}' /proc/acpi/battery/C1E9/state
    ok
    discharging
    2341
    1824
    10969
    ┌─[~]
    └─>
    I think the problem lies in the multiple output of the awk-command, but I'm stuck in solving it.
    Any help would be great.
    Last edited by NeoXP (2009-11-16 22:40:45)

    @ skanky
    Thanks for the suggestion, but you're right I'm not gonna change a working script. It is working exactly as expected.
    @ all
    When interested this is my current handler.sh
    #!/bin/sh
    # Default acpi script that takes an entry for all actions
    # NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
    # modify it to not use /sys
    minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
    maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
    setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
    set $*
    case "$1" in
    button/power)
    echo "PowerButton pressed!">/dev/tty5
    case "$2" in
    PWRF) logger "PowerButton pressed: $2" ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    button/sleep)
    case "$2" in
    SLPB) echo -n mem >/sys/power/state ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    ac_adapter)
    case "$2" in
    AC)
    case "$4" in
    00000000)
    echo -n $minspeed >$setspeed
    #/etc/laptop-mode/laptop-mode start
    00000001)
    echo -n $maxspeed >$setspeed
    #/etc/laptop-mode/laptop-mode stop
    esac
    *) logger "ACPI action undefined: $2" ;;
    esac
    battery)
    if [ `awk '{print $2}' /proc/acpi/ac_adapter/C1E8/state` == "off-line" ];
    then
    logger "battery discharging"
    if (( `awk '{if (NR==5) {print $3}}' /proc/acpi/battery/C1E9/state` >= "250" ))
    then
    logger "battery ok"
    else
    logger "battery not ok"
    /usr/sbin/pm-hibernate;
    fi
    else logger "battery charging"
    fi
    button/lid)
    if [ `awk '{print $2}' /proc/acpi/button/lid/C1ED/state` == "closed" ];
    then
    logger "ACPI lid closed"
    /usr/sbin/pm-suspend
    fi
    logger "ACPI group/action undefined: $1 / $2"
    esac
    Still working on it though

  • Need help with changing my security questions

    I need to know how I can buy songs but I forgot my security questions so how do I change them?

    Alternatives for Help Resetting Security Questions and Rescue Mail
         1. Apple ID- All about Apple ID security questions.
         2. Rescue email address and how to reset Apple ID security questions
         3. Apple ID- Contacting Apple for help with Apple ID account security.
         4. Fill out and submit this form. Select the topic, Account Security.
         5.  Call Apple Customer Service: Contacting Apple for support in your
              country and ask to speak to Account Security.
    How to Manage your Apple ID: Manage My Apple ID

  • I need help with Changing my Security Questions, I have forgotten them.

    Its simple, I tried buying a Gym Buddy Application and I had to answer my security questions... Which I have forgotten I made this a while ago so I probably entered something stupid and fast to make I really regert it now. When i'm coming to this...

    Hello Adrian,
    The steps in the articles below will guide you in setting up your rescue email address and resetting your security questions:
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Apple ID: All about Apple ID security questions
    http://support.apple.com/kb/HT5665
    If you continue to have issues, please contact our Account Security Team as outlined in this article for assistance with resetting the security questions:
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Still need help with changing hostname on Solaris 10

    Hello.
    I have some difficulties with changing host name of my computer.
    It is DHCP Client.
    AS I understand there are the following steps that I have to do:
    1. Edit the /etc/default/dhcpagent file and change the line that reads the following:
    #REQUEST_HOSTNAME=no
    to
    REQUEST_HOSTNAME=no
    2. There are two empty /etc/hostname files: hostname and hostname6.
    Do I have just to put there hostname?
    3. /etc/hosts has what I need to change.
    4. I was unable to find /etc/nodename. Do I have to create it? What properties should contain this file?
    5. hostname <new hostname>
    In previous time when I tried to change host name with Management Console my system crashed, I changed: /etc/hosts, but it didn't work.
    Thank you.

    Hello.
    Using DHCP you may really have problems changing the hostname.
    The fact is: The DNS server may assign your machine a host name which has nothing to do with the host name you sent to the DHCP server. Depending on the server (typically DHCP and DNS server are the same machine) nothing will really work. (This is the case with my configuration where the servers are located on a DSL router.)
    I solved the problem the following way:
    * I created two host names (MyMachine and MyMachineNet) in the /etc/hosts file (Solaris 10 and newer: /etc/inet/ipnodes must be changed, too.)
    * "MyMachine" is 127.0.0.1 (localhost):
    127.0.0.1 localhost MyMachine
    192.168.178.100 MyMachineNet* I assigned the name "MyMachineNet" to the network interface in /etc/hostname.networkcard.
    * I use DHCP
    The computer name (in /etc/nodename) is "MyMachine". Some programs (e.g. Gnome !) establish a TCP/IP connection to "MyMachine" instead of "localhost" (I do not understand why). These programs are now satisfied because the host name "MyMachine" represents 127.0.0.1 (localhost).
    I know that there is a switch that tells Solaris to take the machine name from DHCP/DNS instead of /etc/nodename. Unfortunately I forgot where it is.
    Martin

  • Flash Newbie needs help with Movie Clips/Action Scripting

    Hi -
    I'm having a problem with my movie clips playing
    simultaneously and cannot, for the life of me, figure out what I
    have done wrong. I'm new to flash, so I may have set something up
    incorrectly, but here's what I have so far:
    11 layers, total: 1 layer with 10 control buttons, each
    button with the following actionscript:
    on (release) {
    gotoAndPlay(85);
    Where the number changes in relation to which keyframe the
    next movie is on.
    I have 10 movies, total, but they are only movie clips,
    essentially photo slide shows with audio, made all in the library.
    The problem happens when I click on the second or third
    button. Not only does the movie that I have selected begin to play,
    but all of the previous clips do as well, so it all sounds quite
    garbled. I don't know what I am missing in the action script, as my
    Action Layer has a stop command on it at each keyframe where there
    is a new clip to play.
    I have tried to add a stopAllSounds command, but I'm afraid
    that doesn't do anything because it is not a "sound file" per se,
    playing in the timeline.
    I'm at the end of my rope and really need some help in
    figuring this one out. My project is hanging in the balance on
    this, as I have scripted everything else correctly and it runs
    beautifully.
    Please help!
    Thanks,
    Caroline

    Each layer has a blank keyframe before and after each
    movieclip. Each movie clip is at a different frame. Even with the
    blank keyframes added, the second video starts to play and then the
    first video begins to play. Same happens if I click on the third
    button. Third plays, and starts 1st and 2nd shortly thereafter. Is
    there an action script I can put in that will tell the timeline
    that, when a button is clicked, no matter where the movieclip is,
    it will stop and start the newly selected movieclip?

  • Help with UCCX 8.5 scripting and xmls

    I have a customer with multiple scripts, we are moving them from 3.5 to 8.5 which is running on VMWare.  Here's my scenario:
    The caller can call the trigger 54779, enter a #, then a password of 12345.  Then they can set a normal condition by dialing 1, an after-hours condition by dialing 2, or an emergency condition by dialing 3.  I’m testing the “2” condition now. In the previous 3.5 system, if they dialed 2, the system copied the Doc “2.xml” and copied it to the Doc "Carolina_Access_Emergency_Check.xml", both of which are in the en_US folder in the Documents section.
    I can’t get this thing to change my document "Carolina_Access_Emergency_Check.xml". All I know is that it goes, “unsuccessful”. I’m pretty sure the authentication is working since it gets by that step.  If we can’t get the “copy” to work, really all I need to do with this option 2, is for the data in "Carolina_Access_Emergency_Check.xml" in <TYPE>1</TYPE> to change from a 1 to a 2." I'm attaching a zip with the old and new scripts along with the 2 xml files i'm referring to.  I need help on this one, please!

    Has the user you setup have Application Admin rights? I had this issue when I was trying to create an Emergency shutdown script and the user did not have sufficient rights.
    I don't mind sharing this script I created ,which effectively changes a value from 1 to a 2, which seems to be what you are trying to do but I can not figure out how to share it with you here. You could then use this as example to achieve what you are trying to do.

  • Can anyone help with changing colors without making a selection

    I've been trying to work the the script below. All the front most paths are black I want to change them all to yellow without having to select them first.
    Any help would be really appreciated. "I am a novice javascripter"
    var myStyles = app.activeDocument.pathItems;
    lastStyle=myStyles[myStyles.length-1]
    lastStyle.remove();
    frontStyle=myStyles[0]
    frontStyle.filled=true;
    // Sets the default fill color in the current document to yellow.
    if ( app.documents.length > 0 ) {
    //added
    frontPath = frontStyle;
    // Define the new color
    var newRGBColor = new RGBColor();
    newRGBColor.red = 255;
    newRGBColor.green = 255;
    newRGBColor.blue = 0;
    // Use the color object in the path item
    frontPath.filled = true;
    frontPath.fillColor = newRGBColor;

    A couple of pointers from one novice to another… With script there is NO need to deal with 'selections' to change the writeable properties of any object you simply need reference them with your code as you have done above… You can select art and you can deal with user selected art should you wish but as a rule for all else just target the object with your syntax… The best thing to do is to get your code working… as you know the current state to be ( a document open with you test objects in it ) once you have this then add to it by wrapping your conditionals around this… For example…
    if ( app.documents.length > 0 ) {
         // All your code goes inside this statement
    There is no point in getting the path items of the active document then checking later if there is a doc… Just a case of putting things in there respective order…
    The property filled… I only use to check the state, giving an object a fill will automatically update this… So here are your lines with a little reshuffle and a loop example…
    // Check there is a doc open
    if ( app.documents.length > 0 ) {
              // set a variable to the front document
              var doc = app.activeDocument;
              //Make your new color
              var rgbYellow = new RGBColor();
              // assign some values
              rgbYellow.red = 255;
              rgbYellow.green = 255;
              rgbYellow.blue = 0;
              // set variable to the collection ( list ) you want
              var paths = doc.pathItems;
              // loop this using a variable 'i'
              for ( var i = 0; i < paths.length; i++ ) {
                        paths[i].fillColor = rgbYellow;
              }; // this is your loop ending
    }; // this is the condition ending

  • HELP with my Radiobutton & Checkbox script

    ////the problem is that when I select the Officer RadioButton, only the RT021 checkbox is marked with "X", when I select the Reenlistment RadioButton, everything annotated is selected as it should, when I select the Enlisted RadioButton, nothing happens, all checkboxes are still empty
    all 3 RadioButtons are grouped and I have enetered the script at the group level and not individaul
    I believe that I missed something to actually link the script, not sure
    here is the script:
    ---- from1.NJWPage2.RadioButtonList::change: - (JavaScript, client) ----------------------
    if (Officer.rawValue == 1)
    ISC1.rawValue = "1";
    TAT1.rawValue = "1";
    DD28071.rawValue = "1";
    QCRE1.rawValue = "1";
    RT021.rawValue = "1";
    SOU1.rawValue = "1";
    else
    ISC1.rawValue = "0";
    TAT1.rawValue = "0";
    DD28071.rawValue = "0";
    QCRE1.rawValue = "0";
    RT021.rawValue = "0";
    SOU1.rawValue = "0";
    if (Enlisted.rawValue == 1)
    ISC1.rawValue = "1";
    TAT1.rawValue = "1";
    DD28071.rawValue = "1";
    QCRE1.rawValue = "1";
    SOU1.rawValue = "1";
    else
    ISC1.rawValue = "0";
    TAT1.rawValue = "0";
    DD28071.rawValue = "0";
    QCRE1.rawValue = "0";
    SOU1.rawValue = "0";
    if (Reenlistment.rawValue == 1)
    ISC1.rawValue = "1";
    TAT1.rawValue = "1";
    DD28071.rawValue = "1";
    DD28081.rawValue = "1";
    DD2141.rawValue = "1";
    QCRE1.rawValue = "1";
    RT071.rawValue = "1";
    ENLM1.rawValue = "1";
    SOU1.rawValue = "1";
    PRIVACYACT1.rawValue = "1";
    RELM1.rawValue = "1";
    DD41.rawValue = "1";
    COMPWRKS1.rawValue = "1";
    else
    ISC1.rawValue = "0";
    TAT1.rawValue = "0";
    DD28071.rawValue = "0";
    DD28081.rawValue = "0";
    DD2141.rawValue = "0";
    QCRE1.rawValue = "0";
    RT071.rawValue = "0";
    ENLM1.rawValue = "0";
    SOU1.rawValue = "0";
    PRIVACYACT1.rawValue = "0";
    RELM1.rawValue = "0";
    DD41.rawValue = "0";
    COMPWRKS1.rawValue = "0";
    Your help is greatly appreciated
    Thank You

    Well,
    I installed kedpm with my first working PKGBUILD script.  I was able to import my "fpm" password file.  Once I get my gnucash stuff transfered into grisbi, I will be able to switch my main machine completely to archlinux.
    I know it is trivial for you guys, but here is my script -- it might save you some typing.
    Kev
    pkgname=kedpm
    pkgver=0.4.0
    pkgrel=1
    pkgdesc="Ked Password Manager helps to manage large amounts of passwords and related information"
    url="http://kedpm.sourceforge.net/"
    depends=(python pygtk pycrypto)
    makedepends=()
    conflicts=()
    replaces=()
    backup=()
    install=
    source=(http://dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz)
    md5sums=('6b83a646873f8ea00af9c6403aa259bc')
    build() {
    cd $startdir
    mkdir -p pkg/usr
    cd $startdir/src/$pkgname-$pkgver
    python setup.py install --prefix=$startdir/pkg/usr

  • Help with phpMyAdmin setup.php script

    Hi all,
    I am a newbie to Arch Linux even though I've been running Linux (-only) for more than a year. I have been mostly running Debian based distributions, so sometimes I feel a bit lost on Arch. So far I have been able to set everything up, from wireless to X server (by just reading the instructions, and some posts in the forum).
    Now I am stuck with something that is not so distro-related, I was following this guide (http://wiki.archlinux.org/index.php/LAMP) but I got stuck at the configuration script for phpMyAdmin.
    In fact, when I go to the address http://localhost/phpMyAdmin/scripts/setup.php I can only see the PHP code, not the web page.
    Now I am sure that Apache is running properly since my php test page runs just fine. So I cannot figure out why the setup.php page does not show correctly.
    Could somebody please give me some hints?
    Any help is greatly appreciated,
    Thanks for your time.

    np .. i forgot one point though , you needed to restart the web server so the php module takes the new settings. this is the case fro all config changes to either teh websierver or a modules/addon

  • Help with changing to Sky TV

    Hi,
    I have just cancelled my BT Vision service (OH does not like it) but still have BT Broadband and Calls which we are not changing.  We have no phone line downstairs but a phone line upstairs and are using the BT powerline adapters.  The powerline adapter downstairs is connected to the BT Vision box, the one upstairs is connected to the Home Hub which in turn is connected to the Internet part of the ADSL filter.  Home hub upstairs is also connected via Ethernet to desktop PC.  Downstairs we use wireless for the laptop. 
    My question is, we are thinking about getting a SKY TV package.  They say that we need a telephone line to do this for the box to be connected to.  We have spoken to a local SKY fitter who said we could use the powerline adapters to get around this problem, he didn't say how, but I assume by using the same set up as we have now. 
    Query: would using the powerline adapters which go from the socket upstairs via Ethernet to the home hub and then there is a cable from home hub to ADSL filter work?  I am bothered that there will be something that will cause a problem with it. 
    Also having read bits from the forum it seems to suggest that you can connect to SKY using a wireless setup (as we already do with the laptop) does anyone know if this is true?  We are thinking of getting a SKY+HD box. 
    Please anyone who answers speak in lay terms, above is about the limit of my technical knowledge. 
    Thanks to anyone who can help.   
    Solved!
    Go to Solution.

    wort wrote:
    I am actually asking if you can run SKY TV through BT powerline adapters and through the BT Home hub, which seems to be a question for BT not SKY as they will say as it is BT equipment contact BT.
    If anyone with any knowledge of running SKY and BT in tandom (I am sure there must be some) have any ideas it would be appreciated. 
    You need to ask this question on a Sky forum. The fact you are using BT eqpt means didilly squat. As Guy said, the installation isn't your problem, its the installers.
    But I can tell you one thing, the box does not plug into an internet hub/router. Nor have you been told it needs to be.
    Just ask your questions on a Sky forum and you'll find all the answers you need.
    Rank - Mostly Harmless.

  • Help with selecting files from script menu or drag and drop

    I found this scale images applescript online. It works great when a bunch of files is dragged on top of the script but I would like it to also work when a folder or group of files is selected in the Finder and I activate it from the scripts menu.
    I can't get my on run statement to work. I'm not really an Applescript guy so I'm really just asking if someone can help finish what I started in this on run.
    -- save in Script Editor as Application
    -- drag files to its icon in Finder
    property target_width : 120
    property save_folder : ""
    on run
    tell application "Finder"
    activate
    set folder_path to quoted form of (POSIX path of (the selection as alias))
    set theItems to every file of folder_path
    end tell
    end run
    on open some_items
    -- do some set up
    tell application "Finder"
    -- get the target width, the default answer is the property target_width
    set new_width to text returned of ¬
    (display dialog "Target width:" default answer target_width ¬
    buttons {"OK"} default button "OK")
    if new_width as integer > 0 then
    set target_width to new_width
    end if
    -- if the save_folder property has not been set,
    -- set it to the folder containing the original image
    if save_folder is "" then
    set save_folder to ¬
    (container of file (item 1 of some_items) as string)
    end if
    -- get the folder to save the scaled images in,
    -- default folder is the property save_folder
    set temp_folder to ¬
    choose folder with prompt ¬
    "Save scaled images in:" default location alias save_folder
    set save_folder to temp_folder as string
    end tell
    -- loop through the images, scale them and save them
    repeat with this_item in some_items
    try
    rescaleand_save(thisitem)
    end try
    end repeat
    tell application "Image Events" to quit
    end open
    on rescaleand_save(thisitem)
    tell application "Finder"
    set new_item to save_folder & "scaled." & (name of this_item)
    end tell
    tell application "Image Events"
    launch
    -- open the image file
    set this_image to open this_item
    set typ to this_image's file type
    copy dimensions of this_image to {current_width, current_height}
    scale this_image by factor (target_width / current_width)
    save this_image in new_item as typ
    end tell
    end rescaleandsave

    When items are dragged to your script's icon they are passed in to the on open handler, so this triggers:
    on open some_items
    and the dragged items are passed in as some_items
    In contrast, when you double-click on the script, or invoke it via the Script menu, this runs the on run handler:
    on run
      tell application "Finder"
        activate
        folder_path to quoted form of (POSIX path of (the selection as alias))
        set theItems to every file of folder_path
      end tell
    end run
    However, there's nothing in this block that actually does anything with the selection - you (dangerously) assume that the selection is a folder (you really should check first), and just set theItems to every file in that folder then you exit.
    So to do what you want you'll need to edit your run handler to filter the selection and pass files over to the code that does the hard work.
    You already have the basis for this - your rescaleandsave() handler, so it's just a matter of identifying the files in the selection and passing those over to that handler:
    on run
      tell application "Finder"
        set cur_selection to (get selection) -- get the selection
        repeat with each_item in cur_selection -- iterate through
          if class of each_item is folder then -- do we have a folder?
            set theFiles to every file of each_item -- if so, get its contents
            repeat with each_file in theFiles -- iterate through them
              my rescaleand_save(eachfile) -- and process them
            end repeat
          else if class of each_item is document file then -- do we have a file selected?
            my rescaleand_save(eachitem) -- if so, process it
          end if
        end repeat
      end tell
    end run
    So the idea here is that the run handler gets the selection and works through the (potentially-numerous) items. For each selected item it checks whether its a folder or a file, if its a folder it gets all the files within and passes them to the rescaleandsave handler.
    Note that this is not recursive - it won't catch files within folders within folders - since it only looks at the top level of selected folders, but it wouldn't be hard to rework the script to handle that if that's what you need.

  • Help with EEM TCL / CLI scripting for re-direction/wccp counters

    Being new with EEM scripting I wanted to see if I was on the right track and get some help to finish my idea.
    Our problem I am trying to fix is our remote sites utilize pairs of Cat3650's for some routing and WCCP redirection.  We are encountering ACL denial issues causing slow down and access issues.  The fix for the issue we remove the WCCP service groups to break peering with our wan optimizers and re-insert the configuration thus re-establishing peering and restoring service.
    My idea is to use a TCL scipt on a watchdog timer to parse the "sh ip wccp | inc denied (or unassign)" output for denial and unassignable error counters.  If a counter is found I wanted to create a syslog message that would then kick off a simple EEM CLI script to remove the service groups, wait 10 seconds, then re-add the service groups.  Please point me in the right direction if I am off track as I am not sure if I can use the EEM CLI for all this or since I want to retreive specific info from the sh ip wccp output if I do need to utilize TCL.  I am also unsure if the "total denied" ascii string pulled via the "sh ip wccp | inc denied" will cause issues when attempting to just pull the counter information.
    sh ip wccp | inc Denied Red
            Total Packets Denied Redirect:       0
            Total Packets Denied Redirect:       0
    Script thus far :
    TCL
    if [catch {context_retrieve "EEM_WCCP_ERROR_COUNTER" "count"} result] {
    set wccpcounter 0
    } else {
    set wccpcounter $result
    } if [catch {cli_open} result] {
    error $result
    } else {
    array set cli $result
    } if [catch {cli_exec $cli(fd) "show ip wccp | incl Denied"} result] {
    error $result
    } else {
    set cmd_output $result
    set count ""
    catch [regexp {receive ([0-9]+),} $cmd_output} ignore count]
    set count
    set diff [expr $count - $wccpcounter]
    if {$diff != 0} {
    action_syslog priority emergencies msg "WCCP counters showing incremental Denied packet counts"
    if [catch {cli_close $cli(fd) $cli(tty_id)} result] {
    error $result
    context_save EEM_WCCP_ERROR_COUNTER count
    CLI
    event manager applet WCCP_COUNTER_WATCH
    event syslog priority emergencies pattern "WCCP counters showing incremental Denied packet counts"
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "no ip wccp 61"
    action 004 cli command "no ip wccp 62"
    action 005 wait 10
    action 006 cli command "ip wccp 61"
    action 007 cli command "ip wccp 62"
    action 008 wait 15
    action 009 cli command "clear ip wccp"
    action 010 cli command "end"
    Thanks for all the help

    This won't work as EEM cannot intercept its own syslog messages.  However, I'm not sure why you need this form of IPC anyway.  Why not just make the Tcl script perform the needed CLI commands?
    And, yes, you could use all applets here.  But since you've written the hard stuff in Tcl already, it might be best just to add the missing calls to reconfigure WCCP to that script.

Maybe you are looking for