Help with the Powershell script to collect logs from all domain controllers

I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.

$log = 'application '.
$date = get-date-format MM-DD-YYYY
$now = get-date
$subtractDays = new-object System.TimeSpan 5,0,0,0,0
$then = $Now.Subtract ($subtractDays)
$Computers = get-ADDomainController-filter *.
ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
Invoke-Expression $env:TEMP\Applicationlog.htm

Thank you

Rich

Hello

To help with the repost the question script to the script Center Forum

http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home

Tags: Windows

Similar Questions

  • Help with the PowerShell Script to return speeds - object error - NIC op_Addition physical MethodNotFound

    Hello

    I have some related issues oppose executing this script to list physical NETWORK card speeds by NIC for each host. The error is:

    The method call failed because http://System.Management.Automation.PSObject contains not one me

    Taylor named "op_Addition.

    Online: 12 char: 23

    + += $NicSpReportObj < < < < $NicSpReportObj

    + CategoryInfo: InvalidOperation: (op_Addition:String)], RuntimeException

    + FullyQualifiedErrorId: MethodNotFound

    Hostname Teddy speed

    esx14.domain.com pnic0 1000

    It will list until I would be the last entry in the object but of course its not adding in the previous info (or deleting it may be).

    If someone could take a look it would be great.

    Thank you

    Dan

    Script (also attached):

    $VMHosts = get-VMHost | Sort name | Get-View

    $NicSpReport = @)

    $NicSpReportObj = "" | Select-Object HostName, Teddy bear, speed

    Foreach ($VMHost to $VMHosts)

    {

    $pnic = 0

    {}

    $Speed = $VMHost.Config.Network.Pnic [$pnic]. LinkSpeed.SpeedMb

    $NicSpReportObj.HostName = $VMHost.Name

    $NicSpReportObj.pNIC = ' teddy bear$ Teddy. "

    $NicSpReportObj.Speed = $speed

    $NicSpReportObj += $NicSpReportObj

    {$pnic ++}

    Until the ($pnic - eq ($VMHost.Config.Network.Pnic.Length))

    }

    $NicSpReport += $NicSpReportObj

    $NicSpReport | FT - AutoSize

    I have a little rewriting of your script. I hope it will do what you want now:

    Get-VMHost | ForEach-Object {
      $VMHost = $_
      $VMHost.Extensiondata.Config.Network.Pnic | ForEach-Object {
        $NicSpReportObj = "" | Select-Object HostName, pNIC, Speed
        $NicSpReportObj.HostName = $VMHost.Name
        $NicSpReportObj.pNIC = $_.Device
        $NicSpReportObj.Speed = $_.LinkSpeed.SpeedMb
        $NicSpReportObj
      }
    } | Sort-Object -property HostName,pNIC | Format-Table -AutoSize
    

    Best regards, Robert

    Update: moved the Sort-Object cmdlet at the end of the script to also perform a sort on the attribute of Teddy.

    Post edited by: RvdNieuwendijk

  • Need powershell scripts to collect information from vm disk

    Hello

    I need two scripts to collect information from vm drive,

    1 script to collect information vm disk mode

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | VMDK name | Device label. disksizeInGB | diskmode

    Disc-> Just need the info as persistent or independent_persistent mode

    2. script to collect info RDM of Vm

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | DeviceName | File name | Compatibility mode | Size

    The first script

    Get-VM | %{
         $vm = $_
         $vm | Get-HardDisk | %{
              $_ | select @{N="VM";E={$vm.Name}},
                   @{N="ESX";E={$vm.Host}},
                   @{N="Cluster";E={(Get-VMHost $vm.Host | Get-Cluster).Name}},
                   @{N="VMDK";E={$_.Filename}},
                   @{N="Device Label";E={$_.Name}},
                   @{N="disksizeInGB";E={"{0:N1}" -f ($_.CapacityKB/1MB)}},
                   @{N="Diskmode";E={$_.Persistence}}
         }
    } | ft -AutoSize -Force
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Need help with the Installation of Master Collection

    Sorry if this is in the wrong place, looked everywhere - has not found a forum on the installation or Master Collection - and I feel more comfortable here.

    I own the Master Collection CS4. It was a stand alone and not "upgrade version".

    As I usually do, I left CS3 Design Premium installed because I wanted to wait until all my plugins, etc. are compatible with CS4.  I've since removed CS3.

    Last night I wanted to use the first, for the first time and noticed that it had not been installed.

    I can't find a way to install a program in the suite of the DVD containing all the equipment installation.

    Is there a way to do so that I can add that I don't have?

    I called Adobe phone support. They tell me that I have to uninstall all Adobe software and do a new clean install of Master Collection. I try to avoid it, because I have actions, presets, plugins, preferences, etc. that I want to save.

    Please, someone, is it possible to short do taking an all-day task?

    Thank you.

    JHS

    There is a forum dedicated to Creative Suites:

    http://forums.Adobe.com/community/creativesuites

  • Need a powershell script to collect info patch esx

    Hello

    IAM looking for a powershell script that collects the result of "motion esxupdate" for all versions of esx host 3.5 in the Virtual center 2.5 version and exports to CSV file.

    It should take input as virtual Center and collect all the information of ESX host, connect to esx hosts, run the esxupdate query and update of the CSV with results.

    I got the code base of other scripts. I've pasted below. He collects only results for esx server in view of the need to modify the code for the above requirements.

    -


    $servers = "server0″", server1″

    $account = "root".

    $password = "password".

    $servers | % {$a = plink - pw $password $account@$_ "esxupdate query"

    {$server = $_}

    -


    Thanks in advance!

    Have you tried running the script in the powershell console?

    May be a problem with the vesi script editor.

    Sent from my iPhone

    On 19 March 2010, at 21:14, Sureshadmin<>

  • Please help with the problems of Vista SP2

    So I spent all day on the forums here and I'm head over heels.  I had problems with Windows update and some other problems on my Dell Studio XPS.  It is a tower with double HDs in RAID mirror running Vista 64-bit with SP2.

    I got it for 3 years and I thought that I clean and correct certain defects to go back to the original Dell factory condition.  That did not fix the update install problem I did cleaning.  Now it's worse.

    I'm trying to install SP2 and get a catastrophic failure 0x8000ffff error-UNEXPECTED

    The onlychange is that several months ago, one of my WD 640 GB drives factory failed and I replaced it with a Seagate Barracuda 1 TB since I couldn't find a 640 GB drive.

    I tried to stop and restart all services BITS, etc. no luck.

    I tried to run among the MS FixIt for the problem of update, but it fails because it says that it cannot initialize the powershell.

    Help, please... I'm hopelessly lost and can not spend more money on this thing.

    Thank you!

    If you need additional help with the clean install, please start your own, new topic in this forum: http://answers.microsoft.com/en-us/windows/forum/windows_vista-system

    If these procedures look too complex - and there is no shame in admitting this isn't your cup of tea - take the machine to a local, good reputation and independent (i.e., not a BigBoxStore or a Geek Squad) computer repair shop & ask them to do the job.

  • Need help with the API Explorer

    Hi all

    I am creating a workflow to automate certain tasks of P2V and I want to disconnect the NETWORK adapter prior to anyting on virtual machines. When everything is done, I want reconnect you this NIC I play with vCO for a few months now and I need to get help with the part of the script. I always managed to find a code but this time I did not find anything!

    So I need to script this part! I think I found a way to change the connection settings of the VMXNET3 NETWORK adapter with this part of the code:

    System.getModule("com.vmware.library.vc.vm.spec.config.device").getVirtualVmxnet3(backing,connectable,controllerKey,deviceInfo,key,unitNumber,addressType,macAddress,wakeOnLanEnabled)
    var connectset = new VcVirtualDeviceConnectInfo();
    connectset.connected = false;
    connectset.startConnected = false;
    

    Now, I need to find the way to set these parameters to a VM VMXNET3 adapter?

    How to off the virtual machine to these settings?

    Thanks for your help!

    If you are connected to a distributed switch, they canned for this com.vmware.library.vc.networking.connectVmNicNumberToVirtualDistributedPortgroup action.  If this isn't a vds connect you to, then you need to change then it will have to be slightly modified to use normal NIC instead of vds support.  You will also need to add these lines to the device configuration section:

    devicespec. Device.connectable = new VcVirtualDeviceConnectInfo();

    devicespec. Device.connectable.Connected = true;

    devicespec.device.connectable.startConnected = true;

    I copied this action and added these 3 lines to achieve what it looks like you are trying to do.  We don't really use standard switches in our environment.

    Paul

  • In the Powershell script execution error: could not find the type [ordered]: make sure that the assembly containing this type is loaded.

    People,

    I am trying to load and run the PowerShell script of PowerCLI Module to check the CPU, memory and storage overcommitment. VMware PowerCLI Blog - VMware Blogs but somehow it is always stopped with the error: cannot find the [ordered] type: make sure that the assembly containing this type is loaded.

    Here are some of the diagnostic result:

    $PSVersionTable

    Value name

    ----                           -----

    PSVersion 2.0

    PSCompatibleVersions {1.0, 2.0}

    BuildVersion 6.1.7601.17514

    PSRemotingProtocolVersion 2.1

    WSManStackVersion 2.0

    CLRVersion 4.0.30319.1026

    SerializationVersion 1.1.0.1

    Get-ChildItem ' HKLM:\SOFTWARE\Microsoft\NET frame Setup\NDP'-recurse |

    Get-ItemProperty-name of the EA - 0 Version |

    Where {$_.} PSChildName-match ' ^ (?) (S) \p {L} "} |"

    Select PSChildName, Version

    PSChildName Version

    -----------                       -------

    v2.0.50727 2.0.50727.5420

    3.0.30729.5420 v3.0

    Windows Communication Foundation 3.0.4506.5420

    Windows Presentation Foundation 3.0.6920.5011

    3.5.30729.5420 v3.5

    Customer 4.0.30319

    4.0.30319 full

    Get-PowerCLIVersion

    PowerCLI Version

    ----------------

    VMware vSphere PowerCLI 5.8 Release 1 build 2057893

    ---------------

    Versions of the snap

    ---------------

    Build VMWare AutoDeploy PowerCLI component 5.5 1983942

    Build VMWare ImageBuilder PowerCLI component 5.5 1983942

    Build license of VMware PowerCLI component 5.5 1265954

    Build VMware Storage PowerCLI component 5.8 2057894

    Build VDS's VMware PowerCLI component 5.8 2031581

    Build VMware vSphere PowerCLI component 5.8 2031581

    I installed Windows6. 1 -KB2819745- x 64 - MultiPkg.msu to enable Powershell v4.0 on my Windows 7 laptop, but still the script cannot be executed with the above error message.

    Any kind of aid and assistance would be greatly appreciated.

    Thank you

    Hello-

    Ah, yes--it is that review.

    Another option, because you are not able to go to .NET FX 4.5, is to remove the parts "[ordered]' of the code that you use.  This type Accelerator makes the hash table a dictionary sorted.  The effect to remove that from the code will be that the properties of the object that results will not be in the order in which they appear in the code.

    And, another option would be to install PowerShell v3 (the version in which the '[ordered]' feature has been added').  That shouldn't require a FX .NET newer than what you showed as having already installed on this computer.  However, as we have seen with the PSSnapin and PSv4 Exchange, you want to make sure that the PSSnapins / Modules you want to use are compatible with PowerShell v3.

  • Help with the limits

    OK, so I have a box (40 * 40) which is covered by basic forces (gravity, etc.) and controlled by the left and right of the keyboard keys...

    and a static rectangle which is 450 * 50... So I wrote a simple script to make the box to stop moving in the direction, if the box is in collision with the rectangle...

    This fine all worked but when I add a box rotation stops into thin air because the rectangle has a new width and height...

    Okay so here's the part of the collision script I think I need to change

    var y = this ._y + ySpeed;
    var agree = this ._x + xSpeed;
    var xBoxB1 = _root.line1_mc._x-(line1_mc._width/2);
    var xBoxB2 = _root.line1_mc._x+(line1_mc._width/2);
    var yBoxB1 = _root.line1_mc._y-(line1_mc._height/2);
    var yBoxB2 = _root.line1_mc._y+(line1_mc._height/2);
    If (y + 20 > = yBoxB1 & & y-20 < = yBoxB2 & & agree + 20 > = xBoxB1 & & agree-20 < = xBoxB2) {}
    ySpeed * = - 0.4;
    jumpable = 1;
    } else {}
    ySpeed += gravity;
    jumpable = 0;
    }

    Here is the script in the box 'This' refers to the area and "_root.line1_mc" means the rectangle that has undergone a rotation of 10 degrees... jumpable is a simple variable I've stored to tell weather the box was on the ground (rectangle) or not... and every framework ySpeed is added in FLF box... If it doesn't have sense then I'm sorry, I'm almost confused myself.

    in the conditional statement, I added 20 to the y variable because it is the height of half the box etc...

    So what I need to be able to do, is to know where the rectangle is rather than the box around it? If it makes no sense at all?

    Kudos to anyone who can help me somehow... JAM

    check grant skinner collision detection. Maybe that's all you need:

    http://www.gskinner.com/blog/archives/2005/10/source_code_sha.html

  • Problem with the Update Script

    I'm trying to update a column in the database with the following script, but still get errors on the ORA-00904: "CUSTOMER_CONTACT_NRD." "" "" ACTIVE ": identifier not valid, even thought it must be fair.
    In the end, I want to update the table like that, but first test it on a single customer.
    Are the media may not play directly, or am I missing something else?

    Update v_contact v1
    set
    (v1.inactive_contact) = - 1
    where (v1.cust_id =
    customer_contact_nrd.customer_id and v1.contact_no =
    customer_contact_nrd.contact_no and customer_contact_nrd.active = n
    and v1.cust_id = 106586)

    Thank you for your help.

    Published by: mcramer on October 26, 2009 12:38

    Try something like this...

    Update v_contract v1
    Set v1.inactive_contact = - 1
    where v1.cust_id in
    (by selecting v1.cust_id in customer_contact_nrd v3
    where v1.cust_id = v3.customer_id
    and v1.contact_no = v3.contact_no
    and v3.active = ' n and v1.cust_id = 106586)

    or read this...
    http://www.jlcomp.demon.co.UK/FAQ/lost_update.html

  • I need help with the control of two .swf in third.

    Hi, thanks for reading!

    I need help with the control of two .swf in third.

    I have a problem when I need to use a .swf in a digital signage solution, but were advised by the Legal Department, it cannot be changed in any way, I can not also have the source file blah blah blah. I pulled the .swfs on their site and I decompiled to see what I was up against.

    The main SWF that I need control is HCIC.swf and the problem is that it starts with a preloader, which, after the loading stops on a framework that requires user input to (button) on a play button, until the film will proceed and replay.

    What I've done so far is to create a SWF container, HCIC_container.swf, which will serve as a target for the HCIC.swf and I would like to send actionscript in the file, I am not allowed to edit.

    I managed to get done with help from someone on another forum. It is my hope that the following script just start HCIC.swf a framework after the preloader and button play and just play through.

    var container: MovieClip = createEmptyMovieClip ("container", getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener (this);
    mcLoader.loadClip ("MCIC.swf", container);

    function onLoadInit(mc:MovieClip) {}
    mc.gotoAndPlay (14);
    }

    But unfortunately it does not solve my problem. Because there is a media - controller.swf, which is charged by HCIC.swf who has orders, including the play button to start HCIC.swf.

    Here is a link to a .zip with all 3 files .swf file and all 3 .fla files.

    http://www.axiscc.com/temp/HCIC.zip

    What I have to do is to automatically start the HCIC.swf file, bypassing the pre-loader and play button without having to edit it or in the media - controller.swf in any case. Thus, all scripts must be done in HCIC_container.swf.

    I know it is confusing and it is difficult to explain, but if you look at the files it must make sense.

    ActionScripting is far from my point hard, so I'm definitely over my head here.

    Thanks for your help.

    Got my solution on another forum.

    http://www.ActionScript.org/forums/showthread.php3?t=146827

  • What is the correct way to ask for help with the forum, rather than product, questions?

    I can't find the right way to ask a question about the forums themselves.

    PAGulley said

    I can't find the right part of the forum to ask questions about the forum itself and its features. I wonder what the right place and the way is to get help with the forum system itself. I can find the place to ask questions about specific Mozilla products very well.

    Look up where it says contributor tools and select Contributor Forums. Make sure that you scroll to the top or you'll get a bar with different links instead,

    The forum is https://support.mozilla.org/forums where you question would be better in the SUMO community discussions.

  • Need help with the installation of an adapter of Palit GeForce 9500GT Super chart - 512 MB in a M2N68 (narrated

    Need help with the installation of an adapter of graphics Super Palit GeForce 9500GT - 512 MB - DDR2 SDRAM in a M2N68 motherboard (narra6). Should I disable the onboard graphics in the bios? When the card is installed, no VGA work outs and the PC does not start. Checked and recontroler implementation of the card in the PCI slot. PC is a desktop HP G5200uk PC. Windows 7 operating system.

    Hello

    The link below is a guige to install a video card in your Pc.  In particular, it seems that you will have to perhaps specify the location of the new card in the bios and save this change before you install the new card - see step 4 in the guide on the link below.  If your new card fits into the PCI Express x 16 slot, you will need to define PCI Express in the bios and save the changes.

    http://support.HP.com/us-en/document/c01700855

    Kind regards

    DP - K

  • help with the beats on my envy 17-3270nr, n key

    help with the beats on my envy 17-3270nr key. recent Smart hard disk crash, replaced with exact same hitachi drive, same care extended warranty repairs covered of the Frys. Windows 7 Edition home premium w / service PAC 1 installed, drivers installed, except that now there is no volume of beats on screen graphic dial button, click the button on top button on the page does not call the beat of the application settings. Futhermore; the motion sensors of laser to activate the keyboard backlit keyboard do not work.  Are there drivers hp software to enable the missing features?

    Hello

    Download and install the following.

    HP OSD utility.

    Proximity sensor driver.

    Once completed, restart the laptop.

    Kind regards

    DP - K

  • I need help with the program of Photos on my macbook pro

    I use a Macbook Pro with OS of Yosemite. I really need help with the Photo program. I never really got the hang of IPhoto and now that it's a new program, I'm really confused. Where can I go to learn this without waiting for the next workshop in a local store?

    Hi, I'm fighting to open same mine, making a new software update

Maybe you are looking for

  • Customize does not

    HelloUnknown to me my firefox updated from 28 to the 33.0.2. I had disabled the automatic update but neglected to uncheck "use a background service. Therefore, I try to get my buttons back to the way they were but, when I select 'Customize' located i

  • battery life was very short on Slate 8 pro

    The battery on my slate 8 Pro drains 20-30% every 12 hours, even when it is not used.  I thought maybe it was due to some applications that I had loaded, so I factory reset it and I loaded only the builtin Mail (check schedule) and a couple of new ap

  • Find and replace function in file names?

    Is it possible to do a find and replace in the names of files, rather than the office or similar?  I have a large list of names of files that all have a problem with them I want to replace, but I don't want to pass by and do each manually!  A better

  • Cannot, enter the BIOS with the F1 key.

    Hello I tried to install Mac OS X recently (10.7 Lion on Chameleon 2.1 RC1 16xx with iCloud patch), and the installer crashed. Now when I boot my ThinkPad I press ENTER to display the boot options. When I click on F1 or F12 ThinkPad not responding wh

  • Network help

    I have a HP printer all in one deSKJET 3050. I recently changed my network name and a password to Sky my wi - fi. now, I can't get my computer to print. Help, please!