How to stop get-eventlog command if it finds a hit in the date range... w/o scanning the whole thing first :-/

Hi All, 
I have a nice little PowerShell function that is scrubbing the eventlog for a 'positive' hit under a certain error code for each user in a defined window. 
basically we are looking to see if they are still logging into OCS...
Since it takes what seems like an eternity to scan the whole security log per the 'get-eventlog' statement and then evaluate it it is $true or not... i would like it to break out as soon as it finds one hit without going all the way back x days unless it
has to.
have been trying to use this for testing... with no avail
if (Get-EventLog -LogName Security -ComputerName myOCSserver -after $date -InstanceId 540 -UserName "domain\myuser") {
Write-Host -ForegroundColor Green "UserName found!... Check Passed"
}Else {
Write-Host -ForegroundColor Cyan "UserName not found... delete this account"
if i run the command it will start writing each hit to the screen... i just need it to stop scanning if it finds one but not sure how to break out and now do an action since it is $true... (or $false) :)
Thanks in advance!!!

I'm not sure i'm understanding this correctly but i'm assuming you only care if one shows up in there at all. If so this might speed things up depending on where in the log the first entry is.
Get-EventLog -LogName
Security -ComputerName myOCSserver
-after $date -InstanceId
540 -UserName "domain\myuser" | select -first 1

Similar Messages

  • HT1711 How do I get a album that I purchased already to show the whole album. After the lastest upgrade it only shows one song from the album. I tried repurchasing it but it says that is already purchase but will not re download. Please help.

    How do I get an album from Itunes that I have already downloaded to show the complete album again. After the last update it only shows one song. I tried to re purchase the whole album but it will not let me cause I already purchased it. Pease help

    The large text size makes your post almost impossible to read.
    Excessive use of bold or capitals (also) makes posts difficult to read.
    You can drag most of the column headings left or right, or right-click on the header to turn columns on or off.
    Once you've used File > Display Duplicates or Shift > File > Display Exact Duplicates you can use File > Display All or the Display All button at the bottom of the list to restore the display.
    For general advice on organising your library see this article on Grouping tracks into albums.
    tt2

  • HT1430 How do you reset an iPod 4G. Reset as in reststart the whole thing, to go back when you first got the iPod?

    Help me please

    That would be the other "R" - restore:
    http://www.apple.com/support/ipodtouch/assistant/ipodtouch/#section_5
    Make sure you are following the instructions in this procedure to the letter. Here they are, with emphasis on some easily overlooked requirements:
    Disconnect the USB cable from the iPod touch, but leave the other end of the cable connected to your computer's USB port.
    Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
    If you cannot turn off the device using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the device turns off, release only the Sleep/Wake button.
    Continue pressing and holding the Home button while you reconnect the USB cable to the device. The device should turn on.
    Note: If you see the "low battery" screen, let the device charge for at least ten minutes to ensure that the battery has some charge, and then start with step 2 again.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears (iTunes icon and USB connector) release the Home button.
    If necessary, open iTunes. You should see the "recovery mode" alert ("iTunes has detected a phone in recovery mode").
    Use iTunes to restore the device.
    If you do not see the "Connect to iTunes" screen, try these steps again. If you see the "Connect to iTunes" screen but the device does not appear in iTunes, see this article and its related links.
    Select the iPod in iTunes and choose "restore from backup".

  • Hi, I want to install my lightroom version on a new mac pro. How do i get started. Can't find it on this site. Thx

    I have a new mac book pro and wan't to install my version of lightroom 5 from my old pc to the new one.
    How can i do that? Can't find it here on the site? Thx
    [email protected]

    Hallo, I installed the program as you said. Everything ok.
    When i have to give my serialnummer, it is not accepted. Code is not valid he said
    1160-4008-7475-7547-5706-0812
    Op 21-sep.-2014, om 17:44 heeft Rikk Flohr <[email protected]> het volgende geschreven:
    Hi, I want to install my lightroom version on a new mac pro. How do i get started. Can't find it on this site. Thx
    created by Rikk Flohr in Photoshop Lightroom - View the full discussion
    www.adobe.com
    Hit the Download link at the bottom the page.
    Hit Lightroom
    Hit Free Trial
    When you are done downloading, launch, and enter your serial number from your previous installation.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6749435#6749435
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Lightroom by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • In chrome I'm getting green double underline hyperlinks to ads.  How can I get rid of this without adding more junk to the computer?

    I have both safari and chrome, because I'm used to chrome.  The only extension I have is Google docs.  I started getting green double underline hyperlinks to ads.  How can I get rid of this without adding more junk to the computer?  People suggest programs to do it, but how do I know they won't make it worse?
    Is someone from Apple here and can answer?
    Thanks!

    You may have installed the "VSearch" trojan. Remove it as follows.
    Malware is always changing to get around the defenses against it. These instructions are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data before proceeding.
    Step 1
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including any that have the word "Spigot," "Trovi," or "Conduit" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    Reset the home page and default search engine in all the browsers, if it was changed.
    Step 2
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.vsearch.agent.plist
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item named "com.vsearch.agent.plist" selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.vsearch.daemon.plist
    /Library/LaunchDaemons/com.vsearch.helper.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/VSearch
    /System/Library/Frameworks/VSearch.framework
    ~/Library/Internet Plug-Ins/ConduitNPAPIPlugin.plugin
    Some of these items may be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    The problem may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
    This trojan is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that the Internet criminal behind VSearch has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing has not done so, even though it's aware of the problem. This failure of oversight has compromised both Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • How can I get ALL of my Google Calendars to show on the iCal on my iPhone? I see all of my Google Calendars on the iCal on my Mac, but I do not see them in the iCal on my iPhone. I only see one Google Cal, but not the others.

    How can I get ALL of my Google Calendars to show on the iCal on my iPhone?
    I see all of my Google Calendars on the iCal on my Mac, but I do not see them in the iCal on my iPhone. I only see one Google Cal, but not the others.

    https://www.google.com/calendar/iphoneselect

  • Some USBs don't appear in Finder. They appear in Disk Utilities so how do I get them to appear in Finder?

    Some flash drives/USBs don't appear in Finder. But they appear in Disk Utilities so how do I get them to appear in Finder?

    If you've never used them before (they are new) then they are not formatted for Macs.
    Drive Partition and Format
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Apply button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    When you want to remove an external device you must Eject it:
    First, select the Desktop icon of the external disk. CTRL- or RIGHT-click and select Eject from the context menu.

  • HT3887 my bluetooth says 'Not Available' how do i get it to work again. I have restarted the computer several times and have replaced the batteries in both the keyboard and mouse and yet it still is not working! please help

    my bluetooth says 'Not Available' how do i get it to work again. I have restarted the computer several times and have replaced the batteries in both the keyboard and mouse and yet it still is not working! please help

    I have had the same problem. It was cured by turning computer off and/or restarting it. I am not sure  if once was enough. I think shutting down must cut out whatever it is that blocks bluetooth. Good luck

  • How do you get iTunes purchased songs to automatically play one after the other

    How do you get iTunes purchased songs to play automatically one after the other without having to hit play for each song ? Also I lost all my pictures on my iPad when I installed iOS 7 upgrade. Any way to get them back? Thanks. Dr Ron.

    Hi Dr. Ron,
    By your question, I am wondering if you are playing your music from the iTunes app rather than the Music app?
    In the Music App, you can go to any of the options at the bottom and click on a song to play and it will then continue to play the songs in that category. You can also select "Shuffle" to shuffle them.
    As for your Photos, did you have them backed up anywhere?
    Cheers,
    GB

  • How do I get my ipod to play a playlist from reverse order? (Start with recently added song instead of first added)

    How do I get my ipod to play a playlist from reverse order? (Start with recently added song instead of first added)
    So I'm adding new songs to a very old playlist? Is there anyway that when I add them, they automatically go to top of playlist? How about getting one song to the top of a playlist.  That drag to arrange function is very annoying because it is slow and the playlist does not scroll up very well on a PC.

    Make a new playlist by pressing the little plus button at the very lower left corner of iTunes. An new playlist will appear in the Source pane called "untitled playlist". While the name is highlighted, you can change it to whatever you want. Drag all of the tracks from all the albums that comprise a single book to that playlist. Sync that playlist to your iPod.

  • How can I get Firefox to "grab onto" and then "hold onto" the data signal until I tell Firefox to release it at the end of my session of internet browsing?

    ok, I hope that my description of this problem does not come out in such a disorganized fashion that it makes the description difficult to follow. here goes: every 30 seconds to 1 minute (or thereabouts, I'm estimating) my mobile phone's browser (whether Firefox or any other) loses the data signal, so that tje next time that. I click on something, I get an error message that the "data connection timed out, retry" or "network unavailable" or "check that you are connected to that internet", etc. etc. etc. I have downloaded many apps that are supposed to boost data connectivity and/or improve internet speed, blah, blah, blah, till I discovered that was a problem with the server being able to keep up with staying locked onto my browser. in one of these apps diagnostic screens, I found a notation that therr was something wrong with my cell's relative position. well, how could that be, I wondered, since I had "GPS tracking" "GPS reporting" and "location sharing" all enabled? but, then I noticed, on the image of my cell's location as represented by this particular app, that every half minute, or so, the blue dot which represented my cell's location would slip to the left about one quarter of an inch, or so, and in the longitude and latitude part of this app's diagnostic screen I saw that the numerical designations of my cell's longitude and latitude were zero and zero. it suddenly occurred to me that the server had lost sight of my cell because my cell had moved too far out of the range of that server's sight due to the rotation of the earth. well, blow me down, what am I supposed to do to fix that? how can I tell my cell phone's OS to send out some kind of identifying info on a constant basis, so that the server could keep track of it (and I would not lose the signal)? or, conversely, how could I get my cell phone's browser to grab onto the signal and not let go of it until I was done with that internet session, at which time I would then manually release the signal myself? I hope that my explanation of the problem made enough sense that you could follow it and that you can come up with a workable solution for me. oh yeah, my phone is an LG OPTIMUS ELITE 696. thanx, from the enragedkangaroo.

    Hello,
    I'm afraid I don't think there is going to be much we can do to help you here. The description sounds like an issue with the phone rather than with Firefox specifically.
    I don't think the problem can be caused by you moving out of range of the cell, due to the rotation of the earth. The cell towers (that provide phone signal) are sitting on the earth, just like you, and so move at the same speed as you. This might be a concern with satellite phones using Low Earth Obit satellites but this isn't the case here.
    I think the best thing to do would be to get in touch with your Phone Operator or Device Manufacturer for support. If you are out of the support period or can't get support from them for some other reason then a standard 'cure-all' for mobile phones is to do a Factory Reset. This will return your phone to its default factory settings and wipe all of your data / modifications off the phone. This tends to solve most problems and is probably what the official support team would tell you to do. I can't guarantee that it will help but it has a good chance.
    There are instructions on resetting your phone here:
    http://www.hard-reset.com/lg-optimus-elite-hard-reset.html
    I hope that helps.

  • I have 2 questions regarding the iphone 5. 1 How do i get my yahoo mail set up. I tried the setting it up as both a yahoo mail and other mail. 2. I seem to have lost my notes on my iphone 5 but I have them on my ipad. How can I use cloud to sync my notes?

    I have 2 questions regarding the iphone 5. 1 How do i get my yahoo mail set up. I tried the setting it up as both a yahoo mail and other mail. 2. I seem to have lost my notes on my iphone 5 but I have them on my ipad. How can I use cloud to sync my notes?

    I will address your second question.
    First, make sure your iPhone and iPad have absolutely identical Apple IDs.  If they do, use that Apple ID in Settings > iCloud on your iPhone to select the "Notes" option.  Lo and behold, all your iCloud notes should appear on your iPhone.

  • HT1311 i tried to do a backup from my old iphone as i have a new one that was signed into another itunes account. it said i cant do it because the iphone rejected the request. how do i get around this? i have signed out of the old acct and into mine on th

    i tried to do a backup from my old iphone as i have a new one that was signed into another itunes account. it said i cant do it because the iphone rejected the request. how do i get around this? i have signed out of the old acct and into mine on the phone

    What is the precise wording of the error message that occurs on the old iPhone when attempting to do a backup?
    Are you attempting to backup via iTunes on the computer or iCloud?

  • How do i get my photos to stream to my iPad in the events that were oringally created.  Right now they are streaming as photos and are not grouped at all.  I would like to get them back into the events that were originally created

    how do i get my photos to stream to my iPad in the events that were oringally created.  Right now they are streaming as photos and are not grouped at all.  I would like to get them back into the events that were originally created

    Hi..
    Thanks for the reply..
    My original I Phone 5 was running IOS 6.12
    My I phone 5S currently runs IOS 8..When I upgraded it, it had IOS 7 on it which made the I Photo app compatible with everything below IOS 8...( which the photo app is not compatible with ) so I just connected the I Phone 5S to my computer and thinking the new phone had IOS 7 on it that these was nothing to worry about..I thought all 900 + pictures in the photo stream would transfer but somewhere in the process, I Tunes decides to just go and install IOS 8 which requires that you run a " Photo Migration App" to transfer photos from IOS 7 & below. The problem was is that I didn't want IOS 8 on my new 5S so I thought I wouldn't have to do that part..
    Anyway the phone emerged with IOS 8 on it and the only photos that remained were the ones that were actually on the phone..The 900 + I had in the stream didn't transfer because the Photos that works on IOS 7 and below isn't compatible with IOS 8..I guess you have to use the photo migration app that comes with IOS 8 & I phone 6..But I didn't ask to upgrade to IOS 8...It just did it on it's own!
    I still have the I Phone 5 Back up that I did just before giving it back to Verizon but if I try to restore the I Phone 5S running IOS 8 those photos in the stream will not go back on the phone because IOS 8 isn't compatible with the I Photos" that ran on IOS 7 and below..
    So I have an I Pad mini that runs IOS 7..should I try and erase it...and put that I Phone 5 backup on it and pray the photos that were in the stream come back on it so I can transfer them back to my computer...then erase the I pad mini again and restore it using it's original backup that I have on the computer and the in the cloud?
    I know this sounds confusing but I'm at a loss as to what to do..This is what I found ...http://support.apple.com/en-us/HT201386
    but it doesn't help me..
    Steve

  • How do I get a "transfer images" button to show up in the solution center?

    How do I get a "transfer images" button to show up in the solution center for my officejet 6500 709a on XP?
    Scan buttons are displayed and work, as does print.

    What installing the twain plug-in, you mean? Go to your applications folder. Find the Adobe Photoshop Elements 11 folder. Look in there for a folder called support files, then for a folder called optional plugins. In the Optional Plugins folder, there should be a folder called ImportModules. Just drag that from the Optional Plugins folder to the regular Plugins folder.
    This will be infinitely easier to do if you put your applications folder window into list view, not the default icon view. To do that, click this button at the top of the window:

Maybe you are looking for

  • Video: Sound but no image

    Hi, I'm trying to put a flash .swf video file into a PDF with Acrobat 7.0 Professional using MAC OSX. When I make the video play, all the sound comes through, but the screen remains a black box. I've been able to make other flash movies, and quicktim

  • 2011 Apple Laptop

    I purchased an apple laptop in 2011 and tried to get you to replace it or fix it months later after I found out that there was something wrong with it. A few trips into Apple and they did some work. It was the graphics card, which was the issue well

  • Adding content to a web page [was: Help with basic question (i think)]

    Hi there everyone, first time in this forum. Im creating a website for the first time in dreamweaver after using other programmes and have so far created a banner and nav bar across the left hand side. I am unsure on how i am meant to add any content

  • ICal Events not Repeating!

    Greetings everyone, For a while back (in January 2005), I started an event that I set for repeat every month and stop after 12 times, since then I upgraded to Tiger (a week after Tiger was launched)... This event was repeating itself till October, bu

  • Platform.conf only has 2 lines after install

    Environment: App: Sun ONE Portal Server: Secure Remote Access 6.0 OS: Solaris 2.8 Basic config setup: Portal Server (and SRA) installed on one machine. No SSL. The Portal Server, Gateway and Rewriter proxy are all installed on the same machine. Probl