Help with PS script that gets run when an event ID is triggered.

Hello,
I've had some great help from Mike Laughlin on this forum on creating a simple PS script that can email me when a particular event id is seen on a server.
Here it is:
$serverName = $env:COMPUTERNAME
Send-MailMessage -to [email protected] -Subject "$serverName - Low on Virtual Memory" -body "$serverName
- low on virtual memory" -smtpserver smtp.gb.local -from [email protected]
What I want to add is the event id to in the email too so we can get more information, is this possible?

Here are some suggestions:
Here is a defined trigger for security event ID 5156.  It is good for learning because it happens frequently.
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and EventID=5156]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
<ValueQueries>
<Value name="Application">Event/EventData/Data[@Name='Application']</Value>
<Value name="DestAddress">Event/EventData/Data[@Name='DestAddress']</Value>
<Value name="DestPort">Event/EventData/Data[@Name='DestPort']</Value>
<Value name="SourceAddress">Event/EventData/Data[@Name='SourceAddress']</Value>
<Value name="SourcePort">Event/EventData/Data[@Name='SourcePort']</Value>
<Value name="TimeCreated">Event/System/TimeCreated/@SystemTime</Value>
</ValueQueries>
</EventTrigger>
</Triggers>
The ValueQuery defines the path to the values in the event data.
Here is how we pass the data to the command usingnamed parameters:
<Actions Context="Author">
<Exec>
<Command>powershell</Command>
<Arguments>
-file test5156.ps1
-Application $(Application)
-SourceAddress $(SourceAddress)
-SourcePort $(SourcePort)
-DestAddress $(DestAddress)
-DestPort $(DestPort)
-TimeCreated $(TimeCreated)
</Arguments>
<WorkingDirectory>c:\test</WorkingDirectory>
</Exec>
</Actions>
Notice that I do NOT use single quotes and have formatted the XML so it is easy to edit.
The line breaks are not preserved by the XML when passed and the extra space is unimportant.
Here is the test script that displays the passed arguments.
Param(
$Application,
$SourceAddress,
$SourcePort,
$DestAddress,
$DestPort,
$TimeCreated
'[{0:hh:mm:ss}] {1}' -f [datetime]::Now,'New Event 5156' | Out-file c:\test\testel.log -append
$p=@{
Application=$Application
SourceAddress=$SourceAddress
SourcePort=$SourcePort
DestAddress=$DestAddress
DestPort=$DestPort
TimeCreated=$TimeCreated
$parms=New-Object PsObject -Property $P
$parms |Format-List |Out-String | Out-file c:\test\testel.log -append
Each event ID can have very different data structures  thei si what the 5256 class o structures looks like:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-A5BA-3E3B0328C30D}" />
<EventID>5156</EventID>
<Version>1</Version>
<Level>0</Level>
<Task>12810</Task>
<Opcode>0</Opcode>
<Keywords>0x8020000000000000</Keywords>
<TimeCreated SystemTime="2015-03-18T16:51:12.152331100Z" />
<EventRecordID>34783304</EventRecordID>
<Correlation />
<Execution ProcessID="4" ThreadID="3656" />
<Channel>Security</Channel>
<Computer>W8Test</Computer>
<Security />
</System>
<EventData>
<Data Name="ProcessID">2608</Data>
<Data Name="Application">\device\harddiskvolume4\windows\system32\svchost.exe</Data>
<Data Name="Direction">%%14592</Data>
<Data Name="SourceAddress">239.255.255.250</Data>
<Data Name="SourcePort">1900</Data>
<Data Name="DestAddress">192.168.1.106</Data>
<Data Name="DestPort">2232</Data>
<Data Name="Protocol">17</Data>
<Data Name="FilterRTID">275543</Data>
<Data Name="LayerName">%%14610</Data>
<Data Name="LayerRTID">44</Data>
<Data Name="RemoteUserID">S-1-0-0</Data>
<Data Name="RemoteMachineID">S-1-0-0</Data>
</EventData>
</Event>
Note how the mappingis done from event data name and argument then to PowerSHell Parameter name.
EVENT DATA: <Data Name="SourceAddress">239.255.255.250</Data>
ValueQuery:   <Value name="SourceAddress">Event/EventData/Data[@Name=SourceAddress]</Value>
TRIGGER COMMAND:
       <Arguments>
             -file test5156.ps1
             -SourceAddress $(SourceAddress) 
SCRIPT PARAMS:
     Param(
         $SourceAddress,
¯\_(ツ)_/¯

Similar Messages

  • Help with working script that won't convert på higher version player (As2)

    HI have an issue with a file that was created some time ago to Fplayer v6 and when I now “upgrade” it to 8-9 or 10 it does not load the xml links ;/
    I have no idea why, the file(s) works fine in the old player 6
    I have a set of xml files (note: one file for each country on a map,and the possible solution should not include to put all links in the same xml file)
    the xml looks like this (example is for Denmark file called dk.xml):  [code]
    <broadcast>
    <story>
    <lead>www.alink.com</lead>
    <URL>http://www.alink.com/</URL>
    </story>
    </broadcast>
    So in the flash file I have a set of buttons the does a few actions
    one action is to call/go to a specific frame in a MC in that frame I put the Xl loading stuff for each frame (lable)
    [code]
    headlineXML = new XML();
    headlineXML.onLoad = myLoad;
    headlineXML.load("be.xml");
    function myLoad(ok) {
                                 if (ok == true) {
                                 Publish(this.firstChild);
    function Publish(HeadlineXMLNode) {
    if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
    content = "";
    story = HeadlineXMLNode.firstChild;
    while (story != null) {
                                 if (story.nodeName.toUpperCase() == "STORY") {
                                 lead = "";
                                 URL = "";
                                 element = story.firstChild;
    while (element != null) {
    if (element.nodeName.toUpperCase() == "LEAD") {
    lead = element.firstChild.nodeValue;
    if (element.nodeName.toUpperCase() == "URL") {
                                 URL = element.firstChild.nodeValue;                                                                                                                   
    }                                                         element = element.nextSibling;
    content += "<font size='+2' color='#3366cc'><a href='"+URL+"'>"+lead+"</a></font><br>"+body+"<br><br>";
    txt.htmltext=content;
    story = story.nextSibling;
    the button (main stage)  that calles the MC frame lable with the xml that loads the load thex and a link into a dynamic txt box (called “txt”), has this code on it: [code]
    on (press) {
                                 infoon("DK");
    on (rollOver) {
                                 DK._alpha = 50;
    on (releaseOutside, rollOut, dragOut) {
                                 DK._alpha = 100;
    so as said it works fine in FP 6 (as2)  but when published to FP 8 -9 or 10 only the XML does not load at all
    What could be the issue (I know that it is old code and it is pretty poor and should be fully upgraded but my
    skills is not on that level, I managed to make the above work from some tutorials but understanding the publishing issues
    is a bit over my head J
    I would be extremely gratefull if anyone could help me out it is really frustrating especially since the file actually works fine
    in the old player ;/
    best
    OrsonB

    the two most common issues when converting from as2 vp 6 to as2 vp 6+ are:
    1.  failure to initialize some variable.  (if not explicitly initialized in vp 6, understood to be zero.  in vp+, it's undefined.)
    2.  vp6 is not case-senstive.  vp 6+ is case- sensitive.
    you have both.
    body is undefined and htmltext is not the same as htmlText.  fix those and retest.

  • Help with bash script that fails after suspend to RAM

    I have a very simple reminder script that uses an endless loop, sleep and zenity to pop up a reminder every twenty minutes:
    #!/bin/bash
    while true;
    do
    sleep 20m
    zenity --warning --title="Ergonomics Reminder" --text="Check Posture or Have a Stretch!"
    done
    However, it does not work as it should after suspending to RAM. I am thinking I need to kill the process and restart it after every suspend, using a "thaw" notice in /etc/pm but if there is an easier way to do it please let me know!

    I'm doing this for 2 reasons:
    - as a scripting exercise
    - because the local repo is a shared wordpress mess and people forget to make commits so I'd like a local backup that includes all changes that may not be in github (sadly).
    Anyhow, thanks for the input about trap, I'm definitely confused by it's use at this point but have reworked the script without it.
    #!/bin/sh
    set -e #Exit on any error.
    TIME=`date +"%m.%d.%Y@%H:%M:%S"` # Define the TIME variable as today's date and time.
    MONTH=`date +"%b"` # Define MONTH as today's month.
    FILENAME="backup-$TIME.tar.gz" # Define the filename structure.
    SRCDIR="/stuff" # Define folder to backup.
    DESDIR="/Backup/$MONTH/" # Define the backup folder location.
    LOGFILE="$DESDIR/backup-$TIME.log" # Store the output in a log.
    REMOTE=$(git ls-remote -h origin master | awk '{print $1}') # Get commit hash from head of remote master repo (github)
    LOCAL=$(git rev-parse HEAD) # Get commit hash from head of server repo (dev/test)
    if [[ $LOCAL == $REMOTE ]]; then # If the hashes match
    echo "No update required." >> $LOGFILE # Then no pull is needed
    else # If the hashes don't match then prepare to run our backup
    mkdir -p $DESDIR # Create our directory if it doesn't exist.
    echo "Backup started for "$TIME >> $LOGFILE # Make it log what it's doing.
    tar -cpzf $DESDIR/$FILENAME $SRCDIR >> $LOGFILE 2>&1 # Perform the backup.
    echo "Backup Finished for "$TIME >> $LOGFILE # Log that it's finished.
    echo "Preparing for git pull " >> $LOGFILE #Log what we're doing.
    cd /stuff >> $LOGFILE 2>&1 # Make sure we're in our repo directory
    git pull >> $LOGFILE 2>&1
    echo "Git pull completed successfully. " >> $LOGFILE
    mail -s "Backup log `date`" [email protected] < $LOGFILE # Email the output to me.
    fi

  • Help with a MacPro that is running slow

    I have a 1st gen MacPro that has been running wonderful for years until it started getting slower several months ago and now I get the spinning wheel when I open applications that open very slowly. When they do open a minute later they seem to run fine as long as I don’t open up anything else. OF late though several times right in the middle of my work (either in Illustrator or PS) my screen turns into fuzzy white snow and I have to hard boot my machine. It’s driving me up a wall. I have tried to clear as much space as I could, ran antivirus several times and limit startup items. I’ve also watched the activity monitor and there aren’t really any applications I can close that will limit the RAM. Any ideas?

    Things You Can Do To Keep Your Computer From Slowing Down
    If your computer seems to be running slower here are some things you can do:
    Boot into Safe Mode then repair your hard drive and permissions:
    Repair the Hard Drive and Permissions Pre-Lion
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    Repair the Hard Drive - Lion
    Boot from your Lion Recovery HD. When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported, then click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Restart your computer normally and see if this has helped any. Next do some maintenance:
    Suggestions for OS X Maintenance
    For situations Disk Utility cannot handle the best third-party utility is Disk Warrior;  DW only fixes problems with the disk directory, but most disk problems are caused by directory corruption; Disk Warrior 4.x is now Intel Mac compatible.
    OS X performs certain maintenance functions that are scheduled to occur on a daily, weekly, or monthly period. The maintenance scripts run in the early AM only if the computer is turned on 24/7 (no sleep.) If this isn't the case, then an excellent solution is to download and install a shareware utility such as Macaroni, JAW PseudoAnacron, or Anacron that will automate the maintenance activity regardless of whether the computer is turned off or asleep.  Dependence upon third-party utilities to run the periodic maintenance scripts was significantly reduced since Tiger.  These utilities have limited or no functionality with Snow Leopard or Lion and should not be installed.
    OS X automatically defragments files less than 20 MBs in size, so unless you have a disk full of very large files there's little need for defragmenting the hard drive. As for virus protection there are few if any such animals affecting OS X. You can protect the computer easily using the freeware Open Source virus protection software ClamXAV. Personally I would avoid most commercial anti-virus software because of their potential for causing problems. For more about malware see Macintosh Virus Guide.
    I would also recommend downloading a utility such as TinkerTool System, OnyX 2.4.3, or Cocktail 5.1.1 that you can use for periodic maintenance such as removing old log files and archives, clearing caches, etc.
    For emergency repairs install the freeware utility Applejack.  If you cannot start up in OS X, you may be able to start in single-user mode from which you can run Applejack to do a whole set of repair and maintenance routines from the command line.  Note that AppleJack 1.5 is required for Leopard. AppleJack 1.6 is compatible with Snow Leopard. There is no confirmation that this version also works with Lion.
    When you install any new system software or updates be sure to repair the hard drive and permissions beforehand.
    Get an external Firewire drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. My personal recommendations are (order is not significant):
    Carbon Copy Cloner
    Data Backup
    Deja Vu
    SuperDuper!
    SyncTwoFolders
    Synk Pro
    Synk Standard
    Tri-Backup
    Visit The XLab FAQs and read the FAQs on maintenance, optimization, virus protection, and backup and restore.
    Additional suggestions will be found in Mac maintenance Quick Assist.
    Referenced software can be found at CNet Downloads or MacUpdate.
    Additional Hints
    Be sure you have an adequate amount of RAM installed for the number of applications you run concurrently. Be sure you leave a minimum of 10% of the hard drive's capacity as free space.
    Add more RAM. If your computer has less than 2 GBs of RAM and you are using OS X Leopard or later, then you can do with more RAM. Snow Leopard and Lion work much better with 4 GBs of RAM than their system minimums. The more concurrent applications you tend to use the more RAM you should have.
    Always maintain at least 15 GBs or 10% of your hard drive's capacity as free space, whichever is greater. OS X is frequently accessing your hard drive, so providing adequate free space will keep things from slowing down.
    Check for applications that may be hogging the CPU:
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time, then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Often this problem occurs because of a corrupted cache or preferences file or an attempt to write to a corrupted log file.

  • Can someone help with a div that pops up when you hover over a button?

    I made a div that pops up (stacked on the rest of the page) when you hover over a button (gigs). It works in the safari preview but when I test it online it doesn't. It's above the logo instead of blocking it and on the left site instead of the right. And when you open the page it isn't hidden like in the preview. Does someone know what is wrong?
    The test page: Stuff

    Below code, onclick of 'GIGS' shows pop-up window. You then have a 'close' button which when clicked closes it.
    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!--> <html> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <title>Stuff</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" href="http://www.rockoco.be/stuff/css/main.css">
        <link rel="shortcut icon" href="favicon.ico">
        <link rel="apple-touch-icon" href="favicon.png">
        <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
    <script type="text/javascript">
    function MM_showHideLayers() { //v9.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3)
      with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; }
        </script>
    </head>
    <style>
    #popup {
        position: absolute;
        right: 0;
        z-index: 100;
    #popup img {
    display: block;
    #popup p {
    margin: 0;
    padding: 0;
    #popup a {
        text-decoration: none;
        display: inline-block;
        padding: 8px 12px;
        color: #fff;
        background-color: #000;
    </style>
    <body>
    <div id="popup">
    <img src="http://www.rockoco.be/stuff/img/Flyer-030315.png" alt="popup" width="426" height="605" class="png" />
    <p><a href="#" class="closeWindow">CLOSE</a></p>
    </div>
    <div id="content">
    <h1><img class="svg" src="http://www.rockoco.be/stuff/img/logo.svg" alt="Stuff" /></h1>
    <nav id="social">
        <ul>
       <li><a href="#"><img class="svg" src="http://www.rockoco.be/stuff/img/gigs.svg" alt="Gigs" /></a></li>
            <li><a href="https://twitter.com/36STUFF" target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/twitter.svg" alt="Twitter" /></a></li>
            <li><a href="https://www.facebook.com/STUFF.isthebandname" target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/facebook.svg" alt="Facebook" /></a></li>
            <li><a href="https://soundcloud.com/stuffmusic" target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/soundcloud.svg" alt="Soundcloud" /></a></li>
            <li><a href="http://stuffmusic.bandcamp.com/" target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/bandcamp.svg" alt="Bandcamp" /></a></li>
            <li><a href="https://www.youtube.com/user/duststuff/videos " target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/youtube.svg" alt="Youtube" /></a></li>
            <li><a href="mailto:[email protected]"><img class="svg" src="http://www.rockoco.be/stuff/img/contact.svg" alt="Contact" /></a></li>
        </ul>
        <ul>
             <li><a href="[email protected]" target="_blank"><img class="svg" src="http://www.rockoco.be/stuff/img/remixes_@_ab_klein.svg" alt="Remixes" /></a></li>   
        </ul>
    </nav>
    </div>
    <footer>
        <a class="left" href="http://www.minguely.ch" target="_blank"><img src="http://www.rockoco.be/stuff/img/logo_minguely.png" alt="" /></a>
            <a class="right" href="http://www.martincramatte.com/" target="_blank"><img src="http://www.rockoco.be/stuff/img/logo_martincramatte.png" alt="" /></a>
    </footer>
    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script>
    $(document).ready(function() {
    $('#popup').hide();
    $('.svg').click(function() {
    $('#popup').show()
    $(document).ready(function() {
    $('.closeWindow').click(function() {
    $('#popup').hide()
    </script>
    </body>
    </html>

  • How do I change the loop that is running when an event happens?

    Hello,
       I've written a program that does a linear temperature ramp on sample substrates under UHV. Right now, the program just ramps the current of a power supply(which heats the sample by radiative heating), reads the temperature from a thermocouple, and using a feedback formula adjust the current accordingly so that the ramp stays linear. All of this is done in a while loop.  I now need the program to be able to ramp to a certain temperature, and hold at that temperature for a time period.  I already have the feedback formula written in order to do this, but how do I tell my program to use my new loop once the old loop reaches a certain temperature? I was thinking maybe an event structure, but still not sure on how to use it.  Your help is greatly appreciated, thank you. 

    You need a state machine (or action engine). You can create one, from the Labview templates.
    see here
    An easier way is to stop the loop and continiou with a new loop. Of cource this option is "one way". 
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Can i get help with 2 songs that i downloaded on my itunes? it didnt download, said there was an error and then is stuck at PURCHASED.

    can i get help with 2 songs that i downloaded on my itunes? it didnt download, said there was an error and then is stuck at PURCHASED.

    I'd report the problem to the iTunes Store. 
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the items that are not downloading properly. If you can't see "Report a Problem" next to the items, click the "Report a problem" button. Now click the "Report a Problem" links next to the items.

  • How can I get help with pending songs that have taken over 12 hours to fully download?

    How can I get help with pending songs that have taken over 12 hours to fully download?

    You can only suspend service for 3 months at a time (with or without payment) and only twice a year.

  • HELP with Shell scripting!!!

    Hello all,
    I'm very new to shell scripting and I'm trying to learn a little more as I go on. I'm trying to write a shell script to create a symbolic link to an application and have it moved to the current user's desktop. I've been doing some testing with the default applications installed on Leopard here is what I have so far...
    ls -s /Applications/Chess.app
    I've trying using cp commands, but I continue to get error messages. The above script does create a symbolic link to my home directory, but I want to then move it from the home directory to the current user's desktop. Can anyone lead me any further?
    Thanks in advance for any help!

    I'm also having a problem making my shell script unix executable. I have tried chmod +x path/to/script and then I killall Finder but nothing happens. Am I doing something wrong?
    Are you trying to make your script "Double-Clickable"?
    Then you still need to do the
    chmod +x /path/to/script
    But that will just make it something you can run from a shell.
    If you want double-clickable, you can create an Automator app
    Applications -> Automator -> Run Shell Script
    Or you can download the free Platypus utility that will make any script a double-clickable applications.
    Or you can name your script
    myscript.command
    where the .command is the important part, which the Finder will treat as something it should execute as a shell script when double-clicked.
    And no killing Finder. They will work without messing with the Finder.
    Personally, I prefer the Automator app or Platypus. Well I also work a lot in the shell, and I execute scripts as script in the shell all the time, so I only create a lot more scripts that get executed as commands than I do double-clickable scripts.

  • Using 3rd party binary in script that is run as job

    Hi all,
    I have several scripts to do various tasks with IIS logs we receive from all our various web servers.  One script unzips logs, another logparses to grab a few fields then sftp to a 3rd party for analysis, another will encrypt the original zip files
    in prep for ftp to 3rd party, another will ftp to that 3rd party, and yet another will analyse the logs with our in house analytiscs application.
    I want to have a master script that will run these other scripts as jobs so that it will control when to start certain scripts based on the state of the jobs.  It all seemed to work great as I was setting up test jobs, until I added '3rd' party executables
    like 7-zip, ftp.exe, winscp, etc...  The jobs would just go to failed state when they hit the executables.
    That's not my current problem though as I found out that if I used the
    -windowstyle hidden option for start-process then everything ran as expected, that is until I wanted to log output from the 3rd party app.  FTP for example.
    I tried this:
    $ftpexe = "C:\windows\System32\ftp.exe"
    $ftpscr="d:\scripts\ftpscrtmp.txt"
    "open 111.1.1.1`r`nSomeFTPuser`r`nSomepassword <..bunch of other ftp commands>" | Out-File -FilePath $ftpscr -Append -Encoding "ASCII"
    start-process -wait -filepath $ftpexe -argumentlist $ftparglist  -RedirectStandardOutput $ftplog -windowstyle hidden
    However, asking powershell to redirect output of a hidden window was probably like asking someone to cover their eyes and read a book and it let me know it.
    I have tried without using -windowstyle hidden and not having any luck.  I want to capture the output of the ftp commands so that I can make sure the file was transferred successfully.  If I run the script without -windowstyle hidden and not as
    a job it works, and I can test the output.  I really want to be able to run this script as a job AND get the output of the ftp to a file... advice?
    Thanks in advance!

    This works with no problem for me.
    Start-Process -wait -filepath ftp.exe -argumentlist  '-s:c:\scripts\ftpcmd.txt' -RedirectStandardOutput c:\scripts\ftp.log
    I get no window and the file gets written.
    This is my ftp command file:
    open ftp.microsoft.com
    anonymous
    [email protected]
    ls
    bye
    ¯\_(ツ)_/¯

  • Need help with WMI code that will send output to db

    'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
    and talks to our server. I also want the code to:
    * check the users computer and find all installed patches
    * the date the patches were installed
    * the serial number of the users computer
    * the computer name, os version, last boot up time, and mac address
    and then have all this output to a database file. At the command prompt I've tried:
    wmic qfe get description, hotfixid
    This does return the patch information I'm looking for, but how do I combine that line of code with:
    wmic os get version, csname, serialnumber, lastbootuptime
    and
    wmic nicconfig get macaddress
    and then get all this to output to a database file?

    Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
    found lots of good information. I also found a good command that will print information to a text file.
    Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
    I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
    updates enable, that's because we are not allowed to.   
    This is my code so far. 
    #if you want the computer name, use this command
    get-content env:computername
    $computer = get-content env:computername
    #list of installed patches
    Get-Hotfix -ComputerName $computer#create a text file listing this information
    Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
    I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
    SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
    way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)?

  • How to make a functions that gets called when the plug in is loaded?

    I'm making an automate plugin, and I want to make a functiosn that gets called when Photoshop loads my plugin. It doen't matter if my plug is never called fro the File->Automate menu. Is there any way to do this? Thank you.
    Daniel

    Hi There,
    I don't believe there is a way to handle this currently within App-V...Other virtualization products do have the ability to exclude processes and force to run outside or the bubble or exclude them from terminating on shutdown.
    It would be a great feature request for a future release. You can easily request it here:
    http://appv.uservoice.com/forums/280448-microsoft-application-virtualization
    PLEASE MARK ANY ANSWERS TO HELP OTHERS Blog:
    rorymon.com Twitter: @Rorymon

  • Can anyone help with facetime? im getting missed calls but it doesnt actually tell me i have an incoming call....and the person im trying to contact gets exactly the same.....just missed calls?

    can anyone help with facetime? im getting missed calls but it doesnt actually come up with an incoming call.....the person im trying to contact just gets missed calls also?

    I've noticed that once you miss a call on FaceTime on a desktop Mac, it won't work properly again until you restart the machine.
    I sent in Feedback so we'll see how that goes.

  • Can we have triggers that get fired when we Query a table?

    Hi All,
    What could be the pricise answer to the following question?
    1. Can we have triggers that get fired when we Query a table?
    2. What the relation of triggers and delete, truncate statement in one line?
    3. What is data modelling? Why is it necessary?
    4. Which are not mandatory but essential files in Oracle?
    Regards,
    AAK

    1. Can we have triggers that get fired when we Query a table?for INSERT, UPDATE and DELETE statement, yes
    for SELECT statement, no.
    Question 2 is not clear for me.
    Question 3 is very very general ...
    4 >Which are not mandatory but essential files in Oracle?
    all database files (initialization file, control files, datafiles, redo log files) are mandatory. What is not mandatory but considered as a (very) bad practice is
    to have only 1 control file and only 1 redo log group with 1 redo log file.

  • I need help with fp, i cannot get it to work. have tried everything

    i cannot get fp to work.  I have uninstalled and installed so many times.  I use IE9....it worked two months ago.

    thank you for your reply.  I am using Internet Exp. 9 and McAfee software.  It states it installs and when I open a video, receive message I need to upgrade.  I followed the directions for 32 bit vs 64 bit.   Adobe FP is under my programs????
    > Date: Thu, 8 Sep 2011 05:17:21 -0600
    From: [email protected]
    To: [email protected]
    Subject: I need help with fp, i cannot get it to work. have tried everything
    It won't work or just won't install?
    Which OS, browser(s), and anti-virus software are you using?
    If you're using the free Avira AntiVir(us) Personal software, then deactive the Webguard feature first before installing the Flash Player.
    >

Maybe you are looking for

  • Crystal report viewer 2.0.23 access denied

    Post Author: gionnyDeep CA Forum: General hi all I'm using CR viewer 2.0.23 in a java standalone apllication.Actually whe i try to open a CR XI report with CR viewer 2.0.23 i get Access denied. It look like CR viewer does not fetch login information

  • Bootcamp fails to create windows 7 startup disk

    Bootcamp version 5, running on Mountain Lion, keeps failing on creating the Windows 7 Startup disk. I'm using a 8gb USB drive and it formats it without any problems. The process will carry on until around 50% of copying installation files and then fa

  • TDS on downpayment to Vendors not reversed

    Hi I made downpayment to vendor of Rs.10000 and TDS was deducted of Rs.224 Afterwards i booked invoice of Rs.50000 and TDS was deducted of Rs.1120 When i did F-54, TDS deducted at the start must be reversed. However it did not got reversed. I have se

  • Which Camcorder should I consider?

    I have 14 grandchildren and am not too adept at this new technology, so I'm looking for something that would be good but easy.  Any thoughts?

  • J2ME program not responding in emulator

    Hello gang, I have been writing a sample game program to learn J2ME. I have been developing it in Eclispe with the J2ME plugin and everything has been going great. Well I created a package to see how the size was going (only 19k so far) and when I tr