Help with Powershell script to gather eventlogs from all Domain Controllers

I am trying to write a script to grab the last 5 days of application, security and system logs from all domain controllers. The script runs but only pulls the logs from the local server. The $Computer variable has all of my DC's so it is querying fine. I
assume it is an issue with my ForEach-Object line but it doesn't error out. See the script below.
$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
Thanks,
Rich

Also, you're missing the -ComputerName parameter in the Get-EventLog Cmdlet. 
I would re-write the loop part of the script like this:
$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 ($Computer in $computers) {
Get-EventLog -ComputerName $Computer -LogName $log -After $then -Before $now -EntryType Error |
select EventID,MachineName,Message,Source,TimeGenerated | ConvertTo-html | Out-File .\Applicationlog.htm -append
Invoke-Expression .\Applicationlog.htm
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)

Similar Messages

  • Looking for help with PowerShell script to delete folders in a Document Library

    I'd like to create a PowerShell script to delete old folders in a Document library that are over 30 days old. Has anyone created something like this?
    Orange County District Attorney

    Hello Sid:
    I am trying to do the same and Iam running the script to delete the subfolders inside a folder  but I have some errors. 
    Could you please take a look?
    _______Script________
    $web = Get-SPWeb -Identity https://myportal.mydomain.com
    $list = $web.GetList("ar_mailingactivity")
    $query =  New-Object Microsoft.SharePoint.SPQuery 
    $camlQuery = '<Where><And><Eq><FieldRef Name="ContentType" /><Value Type="Computed">Folder</Value></Eq><Leq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Leq></And></Where>'
    $query.Query = $camlQuery
    $items = $list.GetItems($query)
    for ($intIndex = $items.Count - 1; $intIndex -gt -1; $intIndex--)
       $items.Delete($intIndex);
    ________Errors_______
    Unable to index into an object of type System.Management.Automation.PSMethod.
    At C:\Script.ps1:2 char:22
    + $list =$webGetList <<<< "ar_mailingactivity"]
    + CategoryInfo
    :InvalidOperation: (ar_mailingactivity:String) [], RuntimeException
    + FullyQualifiedErrorID
    :CannotIndex
    You cannot call a method on  a null-valued expression.
    At c:\Script.ps1:6 char:24
    + $items = $list.GetItems <<<< ($query)
    + CategoryInfo
    :InvalidOperation: (GetItems:String) [], RuntimeException
    + FullyQualifiedErrorID
    :InvokeMethodOnNull

  • UnLock Ad user from all Domain controllers

    We have 13 domain controllers in  5 Active directory sites, Unlock status is not updating in All DC's immediately. please help me to unlock Ad user from all the Domain controllers.
    Below is the script to unlock Ad account from one domain controller:
    Clear-Host
    $luser = Read-Host “Input the name (Last name, First name) of the locked user”
    $lockstatus = Get-ADUser "$luser" –Properties lockedout -Server DC10
    if ($lockstatus.lockedout –eq $True)
    $nul = Get-ADUser "$luser" | Unlock-ADaccount
    $nul = Get-ADUser "$luser" | Set-ADAccountPassword -NewPassword “password”
    Write-Host "Account unlocked and password reset"
    if ($lockstatus.lockedout –eq $false)
    Write-Host "Account is not locked"
    Raj

    we have remote site users are facing problems.
    Our L1 agents will unlock User ID in Primary site, replication taking time to replicate to remote DC.
    So need a script to unlock USer ID in all Dcs
    Raj
    Replication of unlocks is faster than you can  do it in script.  It is pushed immediately.  It does not wait fro replication. If thisis not happening then you need to find the problem and fix it.
    You need to fix your problem.  A script will not fix it.
    IF you insist on doing it manually then just run the script one time for each DC.
    If you still do not know what to do you must contact a consultant or your network vendor and have them assist you with this.   We are not a custom solution provider or a free script writing forum.  Doing this would keep you from fixing a problem
    which could lead to other bad things.  Please take the time to take the correct technical steps.
    One thing that might help is to NOT select a DC for the reset.  The DC you are selecting is probably not replicating.  Let Windows choose a DC for you.
    You must run diagnostics on your network to find out what is happening.  Contact you network administrator to do this.  If you do not have a trined network administrator then please contact a consultant or your vendor.
    ¯\_(ツ)_/¯

  • Help with powershell script

    I have an powershell commando that pulls all my machines of xenapp 7.6 that are registered.
    But i want my script to show me output when an machine is unregistered. Can any one help me out with the if and else statement.
    This is for registered machines:
    Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'Registered' }
    Th is for Unregistered servers:
    Get-BrokerMachine | select MachineName, RegistrationState | Where { $_.RegistrationState -eq 'UnRegistered' }
    Output is like this:
    MachineName                                                                                          
    RegistrationState
    XXX\wsgrswxa01                                                                                               
    Registered
    XXX\wsgrswxa02                                                                                               
    Registered
    XXX\wsgrswxa03                                                                                               
    Registered
    I tried a little bit with if and else statement. But i don't know how to do it.
    (example):
    if(?)
    echo “OK status – All XenApp machines or OK”
    exit 0 #Return OK status
    else
    echo “CRITICAL status – These Machines(xxxx,xxxx) are Unregistered”
    exit 2 #returns critical status
    Can anyone help me out?

    Hi,
    you do that by 1) saving the query for unregistered machines, 2) Checking whether there are any unregistered Machines from that variable and 3) Writing down the names (again from the variables).
    Cheers,
    Fred
    oh, ok, here you go :)
    $Machines = Get-BrokerMachine | Where { $_.RegistrationState -eq 'UnRegistered' }
    if (($Machines | Measure-Object).Count -gt 0)
    Write-Output "CRITICAL status – These Machines ($(($Machines | Select-Object -ExpandProperty MachineName) -join ",")) are Unregistered"
    exit 2
    else
    Write-Output "OK status – All XenApp machines or OK"
    exit 0
    There's no place like 127.0.0.1

  • How to copy a folder from TFS source control to Shared location with Powershell script

    Hi,
    I'm looking for a Powershell script where i could copy a folder from TFS Source control to a shared location.
    Details:
    $TeamProject/FolderA - here i want to move FolderA to a shared location called \\Share
    Tried with xcopy: xcopy "$TeamProject/FolderA" "\\Share" ( but no luck, later i found it's only possible to copy files from local to share or share to share location, not from server path to shared location.
    Can someone help me with the power-shell script to achieve above scenario.
    Thanks, BHSR

    Hope the below script works for your scenario. Got the code from http://stackoverflow.com/questions/23739499/copy-files-from-tfs-versioncontrol-to-directory-with-powershell
    $AutoDeployDir = "$\TeamProject/FolderA"
    $deployDirectory = "\\SERVER\SHAREFOLDER\"
    # Add TFS 2013 dlls so we can download some files
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client")
    $tfsCollectionUrl = "http://CDTFSSERVER:8080/tfs/ProjectCollection"
    $tfsCollection = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $tfsCollectionUrl
    $tfsVersionControl = $tfsCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
    # Register PowerShell commands
    Add-PSSnapin Microsoft.TeamFoundation.PowerShell
    # Get all directories and files in the AutoDeploy directory
    $items = Get-TfsChildItem $AutoDeployDir -Recurse -Server $tfsCollection
    # Download each item to a specific destination
    foreach ($item in $items) {
    # Serverpath of the item
    Write-Host "TFS item to download:" $($item.ServerItem) -ForegroundColor Blue
    $destinationPath = $item.ServerItem.Replace($AutoDeployDir, $deployDirectory)
    Write-Host "Download to" $([IO.Path]::GetFullPath($destinationPath)) -ForegroundColor Blue
    if ($item.ItemType -eq "Folder") {
    New-Item $([IO.Path]::GetFullPath($destinationPath)) -ItemType Directory -Force
    else {
    # Download the file (not folder) to destination directory
    $tfsVersionControl.DownloadFile($item.ServerItem, $([IO.Path]::GetFullPath($destinationPath)))
    Regards, Bharath
    LinkedIn:

  • Please help me with Powershell Script - Message Box to display after Installation

    Hi Guys,
    Am using package model to deploy the software. After installation on client machines i want to display a dialog box to notify the successful installation.
    Currently trying VBScript to show the dialog message.
    But few machines i get this dialog and few machines am not getting, in program command line am calling a batch script.
    Now am planning to use a Power shell scripting to show a message box and trying to call it through a batch script.
    Please assist me with the powershell script which will display a message box like above
    (and let me know in script how to enable the set-execution policy Remote signed enabled)
    Thanks,

    You can set the execution settings from within the client settings.
    For a simple message box without having to load assmemblies
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("Operation Completed",0,"Done",0x1)

  • Update a filed value with powershell script with ordery by and where condition

    Hi
    I have below powershell script to update list columns but  how i update a field value with ordery by a column and where condition
    below is the part of my script
    $list = $web.Lists[$listName]
    $items = $list.items
    $internal_counter = 1
    #Go through all items
    foreach($item in $items)
    if($item["CourtNO"] -eq $null)
    #if($item["CourtNo"] -eq '1')
    $item["CaseNo"] = $internal_counter
    #how to add a column ordery by Title
    # and where Title field value from 1 to 10
    $internal_counter++
    adil

    Hi,
    You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
    If so, use CAML query to get the items only match the condition.
    #Build Query
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
    Name="Title"/></OrderBy>'
    $spQuery.Query = $query
    $spQuery.RowLimit = $list.ItemCount
    $items = $list.GetItems($spQuery)
    Hope this help!
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Help with logon script

    Hi
    We have a legacy reporting app (Crystal Distribution 8.5) that relies on DLLs to export data from it to other apps such as Excel.
    In XP/2003 the DLLs are installed and accessed from the WINDOWS & System32 directory but due to changes that MS made in Vista/2008 and higher the DLLS need to be installed in the user's local profile for the app to work properly on Vista/2008+.  Example:
    C:\Users\user.name\WINDOWS\Crystal
    This has been easy to manage for the few users on Win 7 workstations but we are now making the move to Server 2008R2 RDS.  Therefore using a script to put these DLLs in the right place via Group Policy when a user logs on to an RDS server (there will be
    multiple and they will be load balanced) seems the logical answer.
    I am not however an expert on scripting by any means.  I can just about manage a logon script to map a network drive.  Could do with some help on:
    > A logon script that runs once per server per user that I can deploy with a GPO
    > The script needs to create a directory in their local user profile path (as previously mentioned) and copy a list of DLLs to it (or just copy the "Crystal" folder to the WINDOWS folder in their local profile).
    Many thanks

    Hi Flanjman,
    If the servers are deployed on server 2008 R2+, you can try a powershell script, and the script below may be helpful for you, which can create a new directory and copy the local folder to the new created folder:
    $newfolder = "C:\Users\user.name\WINDOWS\Crystal"
    New-Item -Path $newfolder -ItemType directory #create new folder
    copy-item -Path d:\test1 -Destination $newfolder -Force -Recurse #copy all the files in the folder
    Then please save the script above as .ps1 file, and follow this article to deploy in GPO:
    Start Me Up: Scripting a Logon with PowerShell
    Please also note, if the powershell execution policy on all the servers haven't been set to allow to run a powershell script locally, you also need delopy the execution policy in GPO firstly:
    Computer Configuration\ Administrative Templates\ Windows Components\ Windows Powershell" and configure the "Turn on script execution" setting, and choose "Allow local script and remote signed scripts"
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • Need help with a script applied by GPO

    Hello,
    I need to automate WebFeed insertion for Remote App Users at user logon.
    RDS 2012 R2 in place. Remote Apps are provided to W7 clients.
    Currently, WebFeed link must be inserted manually in each user's Control Panel\RemoteApp and Desktop Connections. There
    is no straight forward way from Microsoft.
    But there is a script and instruction I found on web...
    I followed the instruction... Created GPO. GPO applies to user but nothing happens.
    Can somebody check the script and the instruction that I could wrongly applied.
    In instruction there is no word about changing something in the script but only wcx file that the script should
    use.
    The script is below and here is my .wcx file:
    <?xml version="1.0? encoding="utf-8? standalone="yes"?>
    <workspace name="Enterprise Remote Access" xmlns="http://schemas.microsoft.com/ts/2008/09/tswcx" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <defaultFeed url="https://my_webserver_real_FQDN/rdweb/Feed/webfeed.aspx" />
    </workspace>
    I changed the quotes to vertical (") from (”) that
    were in my wcx when copied the lines from web.
    Still not works.
    I
    checked Application log, PowerShell and RemoteApp in eventviewer under user session
    Everything is clean.
    Were I can check the script execution log?
    When the user with applied script logs in, the icon of Remote
    connection appears for 10 seconds on the task bar and disappears.
    Looks like it's trying...
    Check please if the script really should not be touched and provide some troubleshooting
    steps.
    Thanks!
    INSTRUCTIONS from
    the link:
    http://www.concurrency.com/infrastru...rver-2012-rds/
    "Unfortunately
    Windows 7 clients are out of luck here. If you really want to use GPO to deploy
    RemoteApps to Windows 7 clients, then you have to jump through a few
    hoops.
    Create a new GPO and under User ConfigurationPoliciesWindows
    SettingsScripts, double click Logon and click the
    Show Files
    button. This will open an explorer window where you can copy files that will be
    saved within this GPO. Download the
    Install-RADCConnection.ps1 script from the TechNet gallery and
    save it there. Also create a new Text file named something like feed.wcx,
    open it in Notepad and paste in the following three lines of text:
    <?xml
    version=”1.0″ encoding=”utf-8″ standalone=”yes”?>
    <workspace
    name=”Enterprise Remote Access” xmlns=”http://schemas.microsoft.com/ts/2008/09/tswcx”xmlnss=”http://www.w3.org/2001/XMLSchema”>
    <defaultFeed
    url=”https://rds.domain.com/RDWeb/Feed/webfeed.aspx”
    />
    </workspace>
    Now select the PowerShell Scripts tab and
    click the Add button.
    Click Browse and select the .ps1 file and
    for the parameters enter the name of the wcx file. Click OK twice and you are
    ready to scope that policy to a set of users.   
    <#
    .SYNOPSIS
    Installs a connection in RemoteApp and Desktop Connections.
    .DESCRIPTION
    This script uses a RemoteApp and Desktop Connections bootstrap file(a .wcx file) to set up a connection in Windows 7 workstation. No user interaction is required.It sets up a connection only for the current user. Always run the script in the user's session.
    The necessary credentials must be available either as domain credentials or as cached credentials on the local machine. (You can use Cmdkey.exe to cache the credentials.)
    Error status information is saved in event log: (Applications and Services\Microsoft\Windows\RemoteApp and Desktop Connections).
    .Parameter WCXPath
    Specifies the path to the .wcx file
    .Example
    PS C:\> Install-RADCConnection.ps1 c:\test1\work_apps.wcx
    Installs the connection in RemoteApp and Desktop Connections using information
    in the specified .wcx file.
    #>
    Param(
    [parameter(Mandatory=$true,Position=0)]
    [string]
    $WCXPath
    function CheckForConnection
    Param (
    [parameter(Mandatory=$true,Position=0)]
    [string]
    $URL
    [string] $connectionKey = ""
    [bool] $found = $false
    foreach ($connectionKey in get-item 'HKCU:\Software\Microsoft\Workspaces\Feeds\*' 2> $null)
    if ( ($connectionKey | Get-ItemProperty -Name URL).URL -eq $URL)
    $found = $true
    break
    return $found
    # Process the bootstrap file
    [string] $wcxExpanded = [System.Environment]::ExpandEnvironmentVariables($WCXPath)
    [object[]] $wcxPathResults = @(Get-Item $wcxExpanded 2> $null)
    if ($wcxPathResults.Count -eq 0)
    Write-Host @"
    The .wcx file could not be found.
    exit(1)
    if ($wcxPathResults.Count -gt 1)
    Write-Host @"
    Please specify a single .wcx file.
    exit(1)
    [string] $wcxFile = $wcxPathResults[0].FullName
    [xml] $wcxXml = [string]::Join("", (Get-Content -LiteralPath $wcxFile))
    [string] $connectionUrl = $wcxXml.workspace.defaultFeed.url
    if (-not $connectionUrl)
    Write-Host @"
    The .wcx file is not valid.
    exit(1)
    if ((CheckForConnection $connectionUrl))
    Write-Host @"
    The connection in RemoteApp and Desktop Connections already exists.
    exit(1)
    Start-Process -FilePath rundll32.exe -ArgumentList 'tsworkspace,WorkspaceSilentSetup',$wcxFile -NoNewWindow -Wait
    # check for the Connection in the registry
    if ((CheckForConnection $connectionUrl))
    Write-Host @"
    Connection setup succeeded.
    else
    Write-Host @"
    Connection setup failed.
    Consult the event log for failure information:
    (Applications and Services\Microsoft\Windows\RemoteApp and Desktop Connections).
    exit(1)
    --- When you hit a wrong note its the next note that makes it good or bad. --- Miles Davis

    Use GPP for this. Do not use a script.  Post your issues in the GP forum.
    You should also visit the RDS forum to get information on how to distribute remote app links.
    ¯\_(ツ)_/¯

  • Help with simple script

    I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.
    function setProperty(event:MouseEvent):void
    single_mc.alpha=0;
    stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
    Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
    Thanks for your time

    use the snippets panel to help with you with sample code for basic tasks.
    function setProperty(event:MouseEvent):void
    single_mc.visible=false;
    stop_btn.addEventListener(MouseEvent.CLICK, setProperty);

  • Problems with PowerShell script

    Hi guys.
    Using this powershell scripts:
    http://gallery.technet.microsoft.com/office/Lync-Environment-Report-cbc6fb1a
    I have already a opened thread on MS TECHNET FORUM:
    http://social.technet.microsoft.com/Forums/office/en-US/a23ffdf8-fb10-4386-b21b-9f06cda84bdd/lync-environment-report-draw-pictures-in-visio?forum=lyncdeploy
    unable to solve the error for powershell script: New-LyncEnvDiagram.
    Is there any of you Power$hell Mai$ter$ able to understand why the script ain't working?
    with best regards,
    bostjanc

    Hi Bostjanc,
    Since we have no test enviroment, and this is difficult for us to debug the script.
    Maybe you can try to leave a comment to ask the author chris for helps:
    http://emptymessage.com/?p=149
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Help with Indesign script

    Would anyone be willing to help me with a script? I need to Find the first table using "ERTStyle1" table style, convert it to text, change the text style to "Tabfix" paragraph style, then convert it back into a table using the table style "ERTStyle2" convert the top row to a header. It needs to repeat this process until there are no tables left using the "ERTStyle1" table style.
    I think I could almost do this myself using VBScript, but I am relatively new to scripting, and to be honest, I am hoping I can use this script to jump start my knowledge of VB in Indesign.

    So all of this is just to set the column widths to the sizes pre-defined in a paragraph style, i.e., always the same?
    I feel like I almost could do that in VB!
    But in Javascript, all it needs is sth in the ilk of
    var myWidths = [ 10, 50, 100, 50, 12 ]; // in whatever units you fancy
    var myTable = app.activeDocument.stories[0].tables[0];  // (just grabbing some table)
    for (i=0; i<myTable.columns.length; i++)
    myTable.columns[i].width = myWidths[i % myWidths.length];
    .. and the most interesting thing here (written from top of my head) is the "myWidths" lookup: it doesn't matter how many columns there are in this table, 'cause the widths array wraps around. (But you won't need this because you know all of your widths in advance.)

  • Help with two scripts - Mounting remote DMG and Checking which network I'm connected to

    Hey guys, I need some help with two separate scripts:
    1. The first script I'm trying to create to mount a DMG stored remotely on another Mac using an AppleScript or shell script. Using the following:
    set cmd to "hdiutil mount 'afp://username:[email protected]/Lion/Users/username/Desktop/Test.sparseim age'"
    do shell script cmd
    results in the following error:
    error "hdiutil: mount failed - not recognized" number 1
    I'm not very experienced regarding AppleScript or using hdiutil, could somebody point out what's wrong with my script?
    2. The second script I'm working on to try and essentially prevent the 'Could Not Find Server' Finder dialog when a network mount is unavailable. I guess what I'd like it to do is detect which network I'm connected to, and if I'm connected to the correct network, then mount the shares, otherwise just fail silently without any errors. From the searching I've done, using try statements should do this, but they do not, and I'm still presented with an error dialog after the server cannot be found.
    Does anybody have any suggestions on this script? Also, I've seen some tips regarding detecting which wireless network the Mac is connected to, which could work, but what about when connected via Ethernet?
    Thanks!

    Edit: I need to clarify on my first script request:
    I need to mount the DMG on the remote Mac, not on the Mac I'm running the script from.

  • Can anyone help with the scripting on this file?

    Hi, I hope someone with a bigger brain can help me out here.
    I've got an existing Flash CS3 file that makes up the result at http://www.infusion-set.com/flash/Elearning/Inset30/inset30_eguide.html.
    The client has asked if I could add an extra tab at the top after 'Reconnecting' called 'Contact Us' with link to an extra page. All the design has been done in ActionScript 2 with references to XML files for the dynamic content because it's been done in other languages as well.
    I've amended the existing XML file with the correct references for a new page and an accompanying .swf file to play in the animation area.
    I've attempted a .fla version where I duplicated one of the existing tabs script, changed the XML references and changed the variables where necessary to 'con or 'Con' (representing Contact Us). Unfortunately it made the tab menu go completely off the page and was obviously wrong in some way.
    Can anyone give me a clue as to what to change here on the original file as I'm a bit of a novice with ActionScripts, hence me asking.
    For reference I've attached HTML files with the original file scripts and my incorrect version. The  timeline is 103 frames with the scripts placed at frame 1 and 102
    Thanks.
    Garry

    The buttons are all created using the same library object (but MC), except for the code you have in the revised file does not call on that for the con button.
    You have it calling on something with a linkage name of "con", which a quick check tells me doesn't exist--so it is undefined in the code when you try to use it.  I found this by using trace(newConBut._x); after its _x value was assigned, as I mentioned you should try.   So the first thing you want to do is change the following line from...
    var newConBut = _root.attachMovie("con", "conbut", _root.getNextHighestDepth());
    To
    var newConBut = _root.attachMovie("but", "conbut", _root.getNextHighestDepth());
    so that it uses the but MC that serves that purpose in the library.  Then you want to correct the _x assignment of the buttons to what I think you had earlier...
    newConBut._x = 650-newConBut._width;
    newRecBut._x = newConBut._x-newRecBut._width;
    Here is a picture of what those changes do (note, without the XML file I had to finagle things just to work, so the biutton labels aren't what they will be)...

  • Help with MDX script

    Hi , I am trying to develop an MDX script to clear data from a region/slice in ASO cube. I have to select only certain projects with a similarity in their name. I could not find any key word for that , So I have added a UDA for those projects and used the UDA keyword to group them. The script is below:
    alter database BSC_RPT.BSC_RPT Clear data in CurrentTuple( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11],
    [Version].[Current], [Account].[Accountname] ,(Uda ( [Project], "PLN")))
    This script gives me an error "Syntax error at 'Current Tuple'. Please suggest me how to proceed with this. It would be of a great help if you can help me resolve this issue.
    Thanks,
    Ramy

    969637 wrote:
    Hi , I am trying to develop an MDX script to clear data from a region/slice in ASO cube. I have to select only certain projects with a similarity in their name. I could not find any key word for that , So I have added a UDA for those projects and used the UDA keyword to group them. The script is below:
    alter database BSC_RPT.BSC_RPT Clear data in CurrentTuple( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11],
    [Version].[Current], [Account].[Accountname] ,(Uda ( [Project], "PLN")))
    Since the UDA function can return multiple values, you cant use a tuple for this, you would have to crossjoin the set of members of the UDA with the tuple of the other dimensions. You would also not use the currenttuple just the tuple itself
    something like 'crossjoin ({( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11], [Version].[Current], [Account].[Accountname]),({Uda ( [Project], "PLN")}))'
    Note, I did this offhand the syntax may be a little off ot parens and brackets might be off as well

Maybe you are looking for