Forum FAQ: How to troubleshoot DNS Event 5504 error

Symptom
A DNS server may frequently record the Event ID 5504 error in the event log:
Event Type: Warning
Event Source: DNS
Event Category: None
Event ID: 5504
User: N/A
Computer: Computer_name
Description: The DNS server encountered an invalid domain name in a packet from IP_Address .
The packet is rejected.
Cause
Event ID 5504 is logged when a DNS Server receives a packet containing an invalid domain name. There are many possible causes.
1.      The DNS cache becomes corrupt with invalid domain names.
2.      The DNS Server receives a spoofed response.
3.      The DNS response contains domain names with characters other than 0-9, a-z, A-Z, . (Period), and - (Hyphen).
4.      The DNS Server has been configured with invalid forwarders
5.      The network the DNS server resides on is busy or not working properly.
Resolution
The following are general troubleshooting steps for this issue:
1. Secure the DNS cache against pollution.
a)     Open DNS Management snap-in and then open the Properties dialog for the DNS server.
b)     Click the Advanced tab, check the Secure Cache against Pollution option, and then click OK.
c)      After enabling this setting, right-click the applicable DNS server and select Clear Cache, then restart the DNS Server service.
2. Verify that the forwarder list on the DNS server is pointing to recursive DNS servers.  To view the forwarders, please perform the following steps:
a)     Open DNS Management snap-in and then open the Properties dialog for the DNS server.
b)     Click the Forwarders tab, you can view the existing forwarders.
3. Some third party DNS servers may be using records of a type that aren’t supported by Windows DNS servers, such as the DNAME resource record.
920162     Event 5504 is logged when a Windows Server 2003-based DNS server receives a packet that contains a DNAME resource record
http://support.microsoft.com/default.aspx?scid=kb;EN-US;920162
4. Another example where DNS will produce the Event ID 5504 error is when Extended DNS (EDNS) packets are received but the server that is attempting to resolve the EDNS traffic doesn’t support EDNS or have it enabled. An easy workaround is to disable EDNS.
dnscmd /Config /EnableEDnsProbes 0
More Information
Troubleshooting DNS
http://technet2.microsoft.com/WindowsServer/en/library/de2aa69d-1155-4dc9-a651-e836
2f6a81c81033.mspx?mfr=true
DNS Best Practices
http://technet2.microsoft.com/WindowsServer/en/library/59d7a747-48dc-42cc-8986-c73d
b47398a21033.mspx?mfr=true
Applies to
Windows Server® 2003 operating system
Windows Server® 2008 operating system
Windows Server® 2008 R2 operating system

I'm not sure whether this is the appropriate place to add this but - a (possible) cause that I have seen which is not mentioned above is a request for an AAAA record (IPv6 address)
being responded to with an A record (IPv4 address).
DNS debug logging (Windows 2008 R2 SP1) captured requests to
192.225.156.200 and the corresponding responses. In each case the response was followed in the debug log by the event “The DNS server encountered an invalid domain name
in a packet from 192.225.156.200. The packet will be rejected. The event data contains the DNS packet.”
The domain name in the response was the same as that in the query, and looks OK.
The logged query shows an AAAA record (IPv6 address) request and the logged response returned an A record (IPv4 address).
http://www.rfc-editor.org/rfc/rfc4074.txt “Common
Misbehavior Against DNS Queries for IPv6 Addresses” says, under “Expected Behavior”:
   Suppose that an authoritative server has an A RR but has no AAAA RR
   for a host name.  Then, the server should return a response to a
   query for an AAAA RR of the name with the response code (RCODE) being
   0 (indicating no error) and with an empty answer section (see
   Sections 4.3.2 and 6.2.4 of [1]).  Such a response indicates that
   there is at least one RR of a different type than AAAA for the
   queried name, and the stub resolver can then look for A RRs.

Similar Messages

  • [Forum FAQ]How to troubleshoot common issue when configuring user device affinity from usage data

    Symptom:
    Some clients might fail to automatically configure user device affinity from usage data if you have manually configured user device affinity before.
    When you check the UserAffinity.log, you can find the similar error messages as below:
    User 'XXXXX\XXXXX' has xxxxx usage minutes UserAffinity 
    Setting auto affinity for user 'XXXXX\XXXXX'. UserAffinity 
    Found same state message existing. (was sent before) Skip sending same state message for user 'XXXXX\XXXXX'.. UserAffinity 
    Figure 1. Error Message in UserAffinity.log
    Cause:
    As the log said, there is a user affinity state message existing in WMI which prevents client from sending new user affinity state message.
    Resolution:
    We can delete the user affinity state message in WMI to force the client to resend the user affinity state message.
    We can follow the steps below:
      1. Run Windows Management Instrumentation Tester (“Wbemtest”).
      2. In Windows Management Instrumentation Tester dialog box, click “Connect”.(Figure 2)
    Figure 2.
      3. Type “root\ccm\statemsg” under the Namespace table and then click “Connect”.(Figure 3)
    Figure 3.
      4. Click “Enum Classes”. (Figure 4)
    Figure 4.
      5. Choose “Recursive”
    in Superclass Info dialog box.(Figure 5)
    Figure 5.
      6. Double-click “CCM_StateMsg” in Query Result dialog box.(Figure 6)
    Figure 6.
      7. Click “Instances”
    in Object editor for CCM_StateMsg dialog box. (Figure 7)
    Figure 7.
      8. Choose the messages that contain "domain/user_Auto" and click “Delete” in the Query Result dialog box.(Figure 8)
    Figure 8.
    After you delete user affinity state message in WMI, the user affinity state message for the user will be resent. After a period time, we can check the UserAffinity.log to
    see if the user affinity state message has been successfully sent. The related information would be similar as below:
    Successfully sent user affinity state message for user 'xxxxx\xxxxx'.
    Successfully created pending user affinity for user 'xxxxx\xxxxx' into WMI.
    Figure 9.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    I'm not sure whether this is the appropriate place to add this but - a (possible) cause that I have seen which is not mentioned above is a request for an AAAA record (IPv6 address)
    being responded to with an A record (IPv4 address).
    DNS debug logging (Windows 2008 R2 SP1) captured requests to
    192.225.156.200 and the corresponding responses. In each case the response was followed in the debug log by the event “The DNS server encountered an invalid domain name
    in a packet from 192.225.156.200. The packet will be rejected. The event data contains the DNS packet.”
    The domain name in the response was the same as that in the query, and looks OK.
    The logged query shows an AAAA record (IPv6 address) request and the logged response returned an A record (IPv4 address).
    http://www.rfc-editor.org/rfc/rfc4074.txt “Common
    Misbehavior Against DNS Queries for IPv6 Addresses” says, under “Expected Behavior”:
       Suppose that an authoritative server has an A RR but has no AAAA RR
       for a host name.  Then, the server should return a response to a
       query for an AAAA RR of the name with the response code (RCODE) being
       0 (indicating no error) and with an empty answer section (see
       Sections 4.3.2 and 6.2.4 of [1]).  Such a response indicates that
       there is at least one RR of a different type than AAAA for the
       queried name, and the stub resolver can then look for A RRs.

  • [Forum FAQ] How to install and configure Windows Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely

    As we all know,
    the Windows Server Essentials Experience role is available in Windows Server 2012 R2 Standard and Windows Server 2012 R2 Datacenter. We can add the Windows Server
    Essentials Experience role in Server Manager or via Windows PowerShell.
    In this article, we introduce the steps to install and configure Windows
    Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely. For better analyze, we divide this article into two parts.
    Before installing the Windows Server Essentials Experience Role, please use
    Get-WindowsFeature
    PowerShell cmdlet to ensure the Windows Server Essentials Experience (ServerEssentialsRole) is available. (Figure 1)
    Figure 1.
    Part 1: Install Windows Server Essentials Experience role locally
    Add Windows Server Essentials Experience role
    Run Windows PowerShell as administrator, then type
    Add-WindowsFeature ServerEssentialsRole cmdlet to install Windows Server Essentials Experience role. (Figure 2)
    Figure 2.
    Note: It is necessary to configure Windows Server Essentials Experience (Post-deployment Configuration). Otherwise, you will encounter following issue when opening Dashboard.
    (Figure 3)
    Figure 3.
      2. Configure Windows Server Essentials Experience role
    (1)  In an existing domain environment
    Firstly, please join the Windows Server 2012 R2 Standard computer to the existing domain through the path:
    Control Panel\System\Change Settings\”Change…”\Member of. (Figure 4)
    Figure 4.
    After that, please install Windows Server Essentials Experience role as original description. After installation completed, please use the following command to configure Windows
    Server Essentials:
    Start-WssConfigurationService –Credential <Your Credential>
    Note: The type of
    Your Credential should be as: Domain-Name\Domain-User-Account.
    You must be a member of the Enterprise Admin group and Domain Admin group in Active Directory when using the command above to configure Windows Server Essentials. (Figure 5)
    Figure 5.
    Next, you can type the password for the domain account. (Figure 6)
    Figure 6.
    After setting the credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 7)
    Figure 7.
    By the way, you can use
    Get-WssConfigurationStatus
    PowerShell cmdlet to
    get the status of the configuration of Windows Server Essentials. Specify the
    ShowProgress parameter to view a progress indicator. (Figure 8)
    Figure 8.
    (2) In a non-domain environment
    Open PowerShell (Run as Administrator) on the Windows Server 2012 R2 Standard and type following PowerShell cmdlets: (Figure 9)
    Start-WssConfigurationService -CompanyName "xxx" -DNSName "xxx" -NetBiosName "xxx" -ComputerName "xxx” –NewAdminCredential $cred
    Figure 9.
    After you type the commands above and click Enter, you can create a new administrator credential. (Figure 10)
    After creating the new administrator credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 11)
    After a reboot, all the configurations will be completed and you can open the Windows Server Essentials Dashboard without any errors. (Figure 12)
    Figure 12.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Part 2: Install and configure Windows Server Essentials Experience role remotely
    In an existing domain environment
    In an existing domain environment, please use following command to provide credential and then add Server Essentials Role: (Figure 13)
    Add-WindowsFeature -Name ServerEssentialsRole
    -ComputerName xxx -Credential DomainName\DomainAccount
    Figure 13.
    After you enter the credential, it will start install Windows Server Essentials role on your computer. (Figure 14)
    Figure 14.
    After the installation completes, it will return the result as below:
    Figure 15.
    Next, please use the
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with a remote computer. You can use the commands below:
    Enter-PSSession –ComputerName
    xxx –Credential DomainName\DomainAccount (Figure 16)
    Figure 16.
    Then, please configure Server Essentials Role via
    Add-WssConfigurationService cmdlet and it also needs to provide correct credential. (Figure 17)
    Figure 17.
    After your credential is accepted, it will update and prepare your server. (Figure 18)
    Figure 18.
    After that, please type “Y” to continue to configure Windows Server Essentials. (Figure 19)
    Figure 19.
    2. In a non-domain environment
    In my test environment, I set up two computers running Windows Server 2012 R2 Standard and use Server1 as a target computer. The IP addresses for the two computers are as
    below:
    Sevrer1: 192.168.1.54
    Server2: 192.168.1.53
    Run
    Enable-PSRemoting –Force on Server1. (Figure 20)
    Figure 20.
    Since there is no existing domain, it is necessary to add the target computer (Server1) to a TrustedHosts list (maintained by WinRM) on Server 2. We can use following command
    to
    add the TrustedHosts entry:
    Set-Item WSMan:\localhost\Client\TrustedHosts IP-Address
    (Figure 21)
    Figure 21.
    Next, we can use
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with the remote computer. (Figure 22)
    Figure 22.
    After that, you can install Windows Server Essentials Experience Role remotely via Add-WindowsFeature ServerEssentialsRole cmdlet. (Figure 23)
    Figure 23.
    From figure 24, we can see that the installation is completed.
    Figure 24.
    Then you can use
    Start-WssConfigurationService cmdlet to configure Essentials Role and follow the steps in the first part (configure Windows Server Essentials Experience in a non-domain environment) as the steps would be the same.
    The figure below shows the status of Windows Server Essentials.
    Figure
    25.
    Finally, we have successfully configured Windows Server Essentials on Server1. (Figure 26)
    Figure 26.
    More information:
    [Forum
    FAQ] Introduce Windows Powershell Remoting
    Windows Server Essentials Setup Cmdlets
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

  • How to troubleshoot Software Update Deployment Errors

    Hi Guys,
    Could you guys please help me to troubleshoot 'Software Update Deployment Errors'. I have been trying to troubleshoot the below mentioned errors but I am not sure what step should I take for each different errors.
    Could you guys please help me stating what kind of troubleshooting steps should we take for such update deployment errors.
    Many Thanks,
    Chandan

    You would have to examine client-side logs like UpdatesDeployment.log, U*.log in general, ScanAgent.log, WUAHandler.log, WindowsUpdate.log and CI*.log.
    Torsten Meringer | http://www.mssccmfaq.de

  • [Forum FAQ] How to deploy applications remotely

    In some situations, we may need some ways to install applications remotely, here we summarize four general ways to deploy applications.
    1. Using PowerShell to install
    We can use the Win32_Product class to install Windows Installer packages, remotely or locally, so in this way, we can use powerShell command to invoke this function. For example, to install the NewPackage.msi package located in the network
    share \\AppServ\remote on the remote computer PC01, type the following command at the Windows PowerShell prompt:
    (Get-WMIObject -ComputerName PC01 -List | Where-Object -FilterScript {$_.Name -eq "Win32_Product"}).Install(\\AppSrv\remote\NewPackage.msi)
    In same method, we can use the following command to deploy .exe application:
    (Get-WMIObject -ComputerName PC01 -List | Where-Object -FilterScript {$_.Name -eq "Win32_Process"}).Create(\\AppSrv\remote\NewPackage.exe)
    Note: The applications should use Windows Installer technology.
    2. PsExec tool: one of sysinternals utilities
    PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems. So, we can use this feature to install our
    applications, in fact this is similar with PowerShell methods, the only difference is that PsExec is a comprehensive tool. Similarly, we can use the following command to achieve our goal:
    psexec \\PC01  cmd /c  "\\AppSrv\remote\NewPackage.msi" /quiet /norestart
    Note: we can also use PsExec tool to install Microsoft Update file (.msu)
    psexec \\PC01  -s -h -d wusa.exe  "\\AppSrv\remote\NewPackage.msu" /quiet /norestart
    3. Group Policy Software Installation
    In domain environment, this method is very useful to deploy our software. It only supports MSI package for deployment.
    We can choose assign a program to user or computer. If you assign the program to a user, it is installed when the user logs on to the computer. When the user first runs the program, the installation is completed. If you assign the program to a computer,
    it is installed when the computer starts, and it is available to all users who log on to the computer. When a user first runs the program, the installation is completed.
    You can get the installation information of group policy software installation in event viewer, including success or failure.
    4. System Center Configuration Manger
    The Microsoft System Center Configuration Manager software distribution feature provides a set of tools and resources that help you create and manage packages and advertisements used to distribute software to client resources within your enterprise. This
    is a comprehensive suit for deployment.
    How to Deploy Applications in Configuration Manager
    http://technet.microsoft.com/en-us/library/gg682082.aspx
    Summary:
    There are a lot of methods for software deployment, here just introduce some generic ways.
    Here is another important point of software deployment: Some applications do not use windows installer technology. 
    Applications that do not use Windows Installer technology may have application-specific methods for automated deployment. For example, a .exe file may be just a wrapper, it can be anything. To determine whether there is a method for deployment automation,
    check the documentation for the application or consult the application vendor's support system. In some cases, even if the application vendor did not specifically design the application for installation automation, the installer software manufacturer may have
    some techniques for automation.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    In some situations, we may need some ways to install applications remotely, here we summarize four general ways to deploy applications.
    1. Using PowerShell to install
    We can use the Win32_Product class to install Windows Installer packages, remotely or locally, so in this way, we can use powerShell command to invoke this function. For example, to install the NewPackage.msi package located in the network
    share \\AppServ\remote on the remote computer PC01, type the following command at the Windows PowerShell prompt:
    (Get-WMIObject -ComputerName PC01 -List | Where-Object -FilterScript {$_.Name -eq "Win32_Product"}).Install(\\AppSrv\remote\NewPackage.msi)
    In same method, we can use the following command to deploy .exe application:
    (Get-WMIObject -ComputerName PC01 -List | Where-Object -FilterScript {$_.Name -eq "Win32_Process"}).Create(\\AppSrv\remote\NewPackage.exe)
    Note: The applications should use Windows Installer technology.
    2. PsExec tool: one of sysinternals utilities
    PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems. So, we can use this feature to install our
    applications, in fact this is similar with PowerShell methods, the only difference is that PsExec is a comprehensive tool. Similarly, we can use the following command to achieve our goal:
    psexec \\PC01  cmd /c  "\\AppSrv\remote\NewPackage.msi" /quiet /norestart
    Note: we can also use PsExec tool to install Microsoft Update file (.msu)
    psexec \\PC01  -s -h -d wusa.exe  "\\AppSrv\remote\NewPackage.msu" /quiet /norestart
    3. Group Policy Software Installation
    In domain environment, this method is very useful to deploy our software. It only supports MSI package for deployment.
    We can choose assign a program to user or computer. If you assign the program to a user, it is installed when the user logs on to the computer. When the user first runs the program, the installation is completed. If you assign the program to a computer,
    it is installed when the computer starts, and it is available to all users who log on to the computer. When a user first runs the program, the installation is completed.
    You can get the installation information of group policy software installation in event viewer, including success or failure.
    4. System Center Configuration Manger
    The Microsoft System Center Configuration Manager software distribution feature provides a set of tools and resources that help you create and manage packages and advertisements used to distribute software to client resources within your enterprise. This
    is a comprehensive suit for deployment.
    How to Deploy Applications in Configuration Manager
    http://technet.microsoft.com/en-us/library/gg682082.aspx
    Summary:
    There are a lot of methods for software deployment, here just introduce some generic ways.
    Here is another important point of software deployment: Some applications do not use windows installer technology. 
    Applications that do not use Windows Installer technology may have application-specific methods for automated deployment. For example, a .exe file may be just a wrapper, it can be anything. To determine whether there is a method for deployment automation,
    check the documentation for the application or consult the application vendor's support system. In some cases, even if the application vendor did not specifically design the application for installation automation, the installer software manufacturer may have
    some techniques for automation.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

  • [Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line

    Introduction
    Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands.
    Solution
    For character data fields, optional terminating characters allow you to mark the end of each field in a data file with a field terminator, as well as the end of each row with a row terminator. If a terminator character occurs within the data, it is interpreted
    as a terminator, not as data, and the data after that character is interpreted and belongs to the next field or record. I have done a test, if you use BULK INSERT or BCP commands and set the multiple field terminators, you can refer to the following command.
    In Windows command line,
    bcp <Databasename.schema.tablename> out “<path>” –c –t –r –T
    For example, you can export data from the Department table with bcp command and use the comma and colon (,:) as one field terminator.
    bcp AdventureWorks.HumanResources.Department out C:\myDepartment.txt -c -t ,: -r \n –T
    The txt file as follows:
    However, if you want to bcp by using multiple field terminators the same as the following command, which will still use the last terminator defined by default.
    bcp AdventureWorks.HumanResources.Department in C:\myDepartment.txt -c -t , -r \n -t: –T
    The txt file as follows:
    When multiple field terminators means multiple fields, you use the below comma separated format,
    column1,,column2,,,column3
    In this occasion, you only separate 3 fields (column1, column2 and column3). In fact, after testing, there will be 6 fields here. That is the significance of a field terminator (comma in this case).
    Meanwhile, using BULK INSERT to import the data of the data file into the SQL table, if you specify terminator for BULK import, you can only set multiple characters as one terminator in the BULK INSERT statement.
    USE <testdatabase>;
    GO
    BULK INSERT <your table> FROM ‘<Path>’
     WITH (
    DATAFILETYPE = ' char/native/ widechar /widenative',
     FIELDTERMINATOR = ' field_terminator',
    For example, using BULK INSERT to import the data of C:\myDepartment.txt data file into the DepartmentTest table, the field terminator (,:) must be declared in the statement.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,:’,
    The new table contains like as follows:  
    We could not declare multiple field terminators (, and :) in the Query statement,  as the following format, a duplicate error will occur.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,’,
    FIELDTERMINATOR = ‘:’
    However, if you want to use a data file with fewer or more fields, we can implement via setting extra field length to 0 for fewer fields or omitting or skipping more fields during the bulk copy procedure.  
    More Information
    For more information about filed terminators, you can review the following article.
    http://technet.microsoft.com/en-us/library/aa196735(v=sql.80).aspx
    http://social.technet.microsoft.com/Forums/en-US/d2fa4b1e-3bd4-4379-bc30-389202a99ae2/multiple-field-terminators-in-bulk-insert-or-bcp?forum=sqlgetsta
    http://technet.microsoft.com/en-us/library/ms191485.aspx
    http://technet.microsoft.com/en-us/library/aa173858(v=sql.80).aspx
    http://technet.microsoft.com/en-us/library/aa173842(v=sql.80).aspx
    Applies to
    SQL Server 2012
    SQL Server 2008R2
    SQL Server 2005
    SQL Server 2000
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • [Forum FAQ] How do I limit the rendering extension of a report in Report Manager?

    Question:
    There are scenarios that users need to disable some rendering extensions for some specific report. Since the rendering extension is configured for all report, if we modify anything in rsreportserver.config file, it will apply to all reports. How to achieve
    this kind of requirement?
    Answer:
    Since disabling some extensions is only applying for specific reports, we can’t directly modify the configuration file. However, we can have a workaround to achieve this goal on HTML page level. We can embed javascript code in Report page to hide the rendering
    extensions in export format list based on the name of report.
    Open the Report.aspx, the default location is
    C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportManager\Pages
    Add the Javascript code below into the file:
    <script language = "Javascript">
    //javascript: get parameter from URL
    function getParameter(paraStr, url)
        var result = "";
        //get all parameters from the URL
        var str = "&" + url.split("?")[1];
        var paraName = paraStr + "=";
        //check if the required parameter exist
        if(str.indexOf("&"+paraName)!=-1)
            //if "&" is at the end of the required parameter
            if(str.substring(str.indexOf(paraName),str.length).indexOf("&")!=-1)
                //get the end string
                var TmpStr=str.substring(str.indexOf(paraName),str.length);
                //get the value.
                result=unescape(TmpStr.substr(TmpStr.indexOf(paraName) + paraName.length,TmpStr.indexOf("&")-TmpStr.indexOf(paraName) -
    paraName.length));  
            else
                result=unescape(str.substring(str.indexOf(paraName) + paraName.length,str.length));
        else
            result="Null";  
        return (result.replace("&",""));  
    var timer2;
    var dueTime2=0
    function RemoveCTLExportFormats(format)
                    dueTime2 += 50;
                    if(dueTime2 > 30000)
                                    clearTimeout(timer2);
                                    return;
                    var obj=document.getElementsByTagName("Select");
                    for(var i=0;i<obj.length;i++)
                                    if (obj[i].title == "Export Formats")
    var k = -1;
    for(var j = 0; j < obj[i].length; j ++)
    if(obj[i].options[j].value.toLowerCase() == format.toLowerCase())
    k = j;     
    obj[i].options.remove(k);
    clearTimeout(timer2);  
    return;                                                                 
                    timer2=setTimeout("RemoveCTLExportFormats('" + format + "')",50);
    function RemoveOption(report, format)
                    if(getParameter("ItemPath", location.href).toLowerCase() == report.toLowerCase())
                                    timer2=setTimeout("RemoveCTLExportFormats('" + format
    + "')",50);
                    else
                                    return;
    RemoveOption("1", "Excel");
    </script>
    Then we just need to pass the report full path and the export format into RemoveOption function to disable the export format. For example: RemoveOption("/ReportSamples/report1", "Excel");
    Since the javascript is loaded before rendering the report, we have to make the function to run every few milliseconds. This is not efficient and there is such a lot of code. To simplify the code and improve the performance, we can use JQuery to directly get
    the export format we want based on title. So we can change the javascript code into the JQuery code below:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">  
        $(function () {                         
            var result = new RegExp('[\?&]ItemPath=([^&#]*)').exec(window.location.href)[1];          
            var reportName = result.split('%2f')[result.split('%2f').length - 1];
            if (reportName == "1") {
                $("a[title='Excel']").hide();
    </script> 
    The result looks like below:
    Applies to:
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Reporting Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi Grégory
      Thanks for answering . . .
       How is this different from any other conditional formatting?  I'm sorry, but I really don't understand.  If I can change the color of text based on a condition or conditionally suppress a detail row, why can't I change the row background color based on the toggle state when the textbox is toggled?  If it's just not possible, then how is textbox.togglestate used?  Is is only used to set the initial toggle state programmatically? 
        I'm really confused.  Clearly, an event is fired when you toggle a textbox.  The screen gets refreshed.  I don't understand why I can't conditionally color a row based on the toggle state of a text box.  Please help me understand - or guide to a place that explains how that textbox property is used.
    Thanks!
    Karen

  • [Forum FAQ] How to convert data of date time's type stored in database to display Time Zone based on different territories?

    Introduction:
    There is a date’s type field in the database. When using the field in the report, clients want to convert the field’s values based on own Time Zone to show the date field.
    Workaround:
    Currently, Reporting Services doesn’t provide the function that can get the Time Zone of a client machine. To work around the issue, you need to add a custom code in the report to convert Time Zone and create a parameter through which the client users can
    select his/her Time Zone, and then pass the parameter value to the custom function. Please see the details as follows:
    1. Click the Report, select Report Properties and add the custom code as the screenshot shown:
    Custom code:
    Shared Function FromUTC (ByVal d As Date, ByVal tz As String) As Date
    Return (TimeZoneInfo.ConvertTimeBySystemTimeZoneId(d, TimeZoneInfo.Utc.Id, tz))
    End Function
    2. Create a parameter named TimeZone (you can name the parameter according to your requirement), select Available value and click Specify values.
    Label                                                               
    Value
    China Standard Time                                        
    China Standard Time
    Central European Time Zone                              Central European Time Zone
    India Time Zone                                               
    India Time Zone
    United States of America Time zones                   United States of America Time zones
    3. Call the custom code and type the expression to convert the Time Zone as follows:
    =Code.FromUTC(Fields!UTCDateFromDatabase.Value,Parameters!TimeZone.Value)
    Note: If you use the expression “=Code.FromUTC(Fields!UTCDateFromDatabase.Value,TimeZone.CurrentTimeZone.StandardName)”, it cannot achieve the goal because TimeZone.CurrentTimeZone.StandardName gets the TimeZone of Report Server side rather than Client side.
    More information:
    TimeZone Class
    http://msdn.microsoft.com/en-us/library/system.timezone(v=vs.110).aspx
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012

    Hello,
    Please read the answer provided by Kalman on the following thread:
    http://social.technet.microsoft.com/Forums/es-ES/446df85a-7ad8-4891-8748-478a26350c5c/how-to-compare-tables-in-two-different-servers-while-one-of-the-server-name-has-a-?forum=transactsql
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • [Forum FAQ] How to display an image from Http response in Reporting Services?

    Question:
    There is a kind of scenario that users want to display an image which is from URL. In Reporting Services, if the URL points to an image file, we can directly display it by typing the URL in embedded image. However, some URLs are just sending Http requests
    to server side, then redirect to another position and the server will return the image. For these kind of URLs, Reporting Services can’t directly render the image from Http response.
    Answer:
    To achieve this goal, we can add custom code into the report. Pass the URL as argument into our custom function so that we can create HttpRequest and get the HttpResponse. Then we can use custom function to return the Bytes() from the HttpResponse and render
    it into an image in report.
    Ps: In Reporting Services, it only support drawing Bytes() array into image, so we need to have our custom function return Bytes array.
    Add the assembly and custom code into the report.
    Public shared Function GetImageFromByte(Byval URL as String) As byte() 
                    Dim photo as System.Drawing.Image 
             Dim Request As System.Net.HttpWebRequest 
           Dim Response As System.Net.HttpWebResponse 
                  Request = System.Net.WebRequest.Create(URL)         
                     Response = CType(Request.GetResponse, System.Net.WebResponse) 
                 If Request.HaveResponse Then  
                      If Response.StatusCode = Net.HttpStatusCode.OK Then                    
                           photo = System.Drawing.Image.FromStream(Response.GetResponseStream) 
                     End If 
                 End If 
                  Dim ms AS System.IO.MemoryStream = new System.IO.MemoryStream() 
                 photo.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg) 
                    Dim imagedata as byte()  
                    imagedata = ms.GetBuffer()  
                    return imagedata
    End Function
    Grant the permission for assemblies. 
    Go to: 
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSpreviewPolicy.config 
    C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\rssrvpolicy.config
    Give “FullTrust” for Report_Expressions_Default_Permissions.
    Insert an image into report. 
    Expression:
    =Code.GetImageFromByte("https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSrVwPoAtlcA2A3KaiAJi-XjS4icr1QUnKYr7uzpX3IL3g2GPisAQ")
    The Result looks below:
    Applies to:
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Reporting Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    >
    Hi, I'd like to display a dynamic image from the web inside a JLabel or any other swing component it could work in. I've been looking on the Swing tutorials and others forums, all I can have is that a JLabel can load an Icon object, defined by an image URL, but can this URL be like "http://xxxxx/image.jpg" somehow or can it only be a local image URL?>
    I do not know why you start talking about an image on the web then go on to show concerns about whether it will work for a 'local' URL.
    But perhaps this answer will cover the possibilities.
    So long as you can from an URL to the image, and the bytes are available for download (e.g. some web sites wrap a direct call to an image in HTML that embeds the image), the URL based icon constructors will successfully load it.
    It does not matter if that URL points to
    - a web site,
    - a local server ('localhost'),
    - an URL representation of a File on the local file system, or
    - it is inside a Jar file that is on the application's run-time classpath.
    How you go about forming a valid URL to a 'local resources' (or indeed what you regard as local resources) is another matter, depending on the form of the project, and how the resources are stored (see list above).
    Probably the main reason that examples use images at a hard coded URL on the net is that it makes an 'image example' self contained. As soon as we compile and run it, we can see the result. I have posted a few examples like that on these forums.
    Edit 1:
    BTW - Welcome to the Sun forums
    Edited by: AndrewThompson64 on Apr 21, 2009 12:15 PM

  • [Forum FAQ] How to use parameter to control the Expand/Collapse drill-down options in SSRS report?

    In SQL Server Reporting Services (SSRS), drill-down is an action we can apply to any report item to hide and show other report items. They all are ways that we can organize and display data to help our users understand our report better. In this article,
    we are talking about how to use parameter to control the Expand/Collapse drill-down options in SSRS report.
    Consider that the report has a dataset (dsSales) with following fields: SalesTerritoryGroup, SalesTerritoryCountry, CalendarYear, SalesAmount.
    1. The report has the following group settings:
    Parent Group: SalesTerritoryGroup
     Child Group: SalesTerritoryCountry
      Child Group: CalendarYear
       Details: SalesAmount
    2. Add three parameters in the report:
    GroupExpand:
    Available Values: “Specify values”
    Label: Yes           Value: Yes
    Label: No            Value: No
    Default Values: “Specify values”
    Value: Yes
    CountryExpand:
    Available Values: “Specify values”
    Label: Yes           Value: =IIF(Parameters!GroupExpand.Value="No",Nothing,"Yes")
    Label: No            Value: No
    Default Values: “Specify values”
    Value: =IIF(Parameters!GroupExpand.Value="No","No","Yes")
    YearExpand:
    Available Values: “Specify values”
    Label: Yes          
    Value: =IIF(Parameters!GroupExpand.Value="No" or Parameters!CountryExpand.Value="No",Nothing,"Yes")
    Label: No            Value: No
    Default Values: “Specify values”
    Value: =IIF(Parameters!GroupExpand.Value="No" or Parameters!CountryExpand.Value="No","No","Yes")
    3. Right click SalesTerritoryCountry icon in the Row Groups dialog box, select Group Properties.
    4. Click Visibility in the left pane. Select “Show or hide based on an expression” and type with following expression:
    =IIF(Parameters!GroupExpand.Value="Yes", False, True)
    Select “Display can be toggled by this report item” option, and select “SalesTerritoryGroup” in the drop down list.
    5. Use the same method setting CalendarYear, (Details) drill-down with following expression:
    =IIF(Parameters!CountryExpand.Value="Yes", False, True)
    =IIF(Parameters!YearExpand.Value="Yes", False, True)
    6. Click SalesTerritoryGroup text box in the tablix. Select InitialToggleState property in the Properties dialog box, and type following expression:
    =IIF(Parameters!GroupExpand.Value="Yes", True, False)
    7. Use the same method setting SalesTerritoryCountry, CalendarYear text box with following expression:
    =IIF(Parameters!CountryExpand.Value="Yes", True, False)
    =IIF(Parameters!YearExpand.Value="Yes", True, False)
    After that, when we preview the report, we can use these three parameters to expand/collapse drill-down.
    Note:
    In our test, we may meet following issue. We can check the expression of InitialToggleState property to troubleshooting the issue.
    Applies to
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012

    In SQL Server Reporting Services (SSRS), drill-down is an action we can apply to any report item to hide and show other report items. They all are ways that we can organize and display data to help our users understand our report better. In this article,
    we are talking about how to use parameter to control the Expand/Collapse drill-down options in SSRS report.
    Consider that the report has a dataset (dsSales) with following fields: SalesTerritoryGroup, SalesTerritoryCountry, CalendarYear, SalesAmount.
    1. The report has the following group settings:
    Parent Group: SalesTerritoryGroup
     Child Group: SalesTerritoryCountry
      Child Group: CalendarYear
       Details: SalesAmount
    2. Add three parameters in the report:
    GroupExpand:
    Available Values: “Specify values”
    Label: Yes           Value: Yes
    Label: No            Value: No
    Default Values: “Specify values”
    Value: Yes
    CountryExpand:
    Available Values: “Specify values”
    Label: Yes           Value: =IIF(Parameters!GroupExpand.Value="No",Nothing,"Yes")
    Label: No            Value: No
    Default Values: “Specify values”
    Value: =IIF(Parameters!GroupExpand.Value="No","No","Yes")
    YearExpand:
    Available Values: “Specify values”
    Label: Yes          
    Value: =IIF(Parameters!GroupExpand.Value="No" or Parameters!CountryExpand.Value="No",Nothing,"Yes")
    Label: No            Value: No
    Default Values: “Specify values”
    Value: =IIF(Parameters!GroupExpand.Value="No" or Parameters!CountryExpand.Value="No","No","Yes")
    3. Right click SalesTerritoryCountry icon in the Row Groups dialog box, select Group Properties.
    4. Click Visibility in the left pane. Select “Show or hide based on an expression” and type with following expression:
    =IIF(Parameters!GroupExpand.Value="Yes", False, True)
    Select “Display can be toggled by this report item” option, and select “SalesTerritoryGroup” in the drop down list.
    5. Use the same method setting CalendarYear, (Details) drill-down with following expression:
    =IIF(Parameters!CountryExpand.Value="Yes", False, True)
    =IIF(Parameters!YearExpand.Value="Yes", False, True)
    6. Click SalesTerritoryGroup text box in the tablix. Select InitialToggleState property in the Properties dialog box, and type following expression:
    =IIF(Parameters!GroupExpand.Value="Yes", True, False)
    7. Use the same method setting SalesTerritoryCountry, CalendarYear text box with following expression:
    =IIF(Parameters!CountryExpand.Value="Yes", True, False)
    =IIF(Parameters!YearExpand.Value="Yes", True, False)
    After that, when we preview the report, we can use these three parameters to expand/collapse drill-down.
    Note:
    In our test, we may meet following issue. We can check the expression of InitialToggleState property to troubleshooting the issue.
    Applies to
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012

  • [Forum FAQ] How to sync time with a Domain Controller for a standalone server

    As we all known, if a computer belongs to an Active Directory domain, it will sync the time automatically by using the Windows Time service that is available on Domain Controllers.
    While a standalone server will synchronize with its local hardware time and Windows time server. (Figure 1)
    Figure 1.
    Under some circumstances, a standalone server is necessary in a product environment. We can sync the time of this standalone server with the Domain Controller using
    the steps below:
    1. Modified the value of the AnnounceFlags:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
    Under this entry we can see the default value of AnnounceFlags is 10 (Decimal), we configure the value as 5 (Decimal). (Figure 2)
    Figure 2.
    2. Confirm the value of the registry key below is set to 0:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer 
    Figure 3.
    3. Configure the standalone server to synchronize with a specific time source (Domain Controller).
    In our test, we configured our Domain Controller (192.168.10.200) as the time source. Used the following commands:
    w32tm /config /syncfromflags:manual /manualpeerlist:192.168.10.200
    4. Sync the time with the Domain Controller using the command below:
    w32tm /config /update
    From the figure below (Figure 4), you can see the after we did all the steps above, the time on the standalone server was synced with the Domain Controller.
    Figure 4.
    (Note: Peerlist is a separated list of DNS servers, or IP Addresses for the time servers)
    More information:
    Windows Time Service Tools and Settings
    http://technet.microsoft.com/en-us/library/cc773263(WS.10).aspx#w2k3tr_times_tools_dyax
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thank you for the instruction! I am sure it is one of the scenarios that majority of administrators will run into. So I suggest to write a wiki about it and publish it for this month's TechNet Guru in Windows Server section. This month's TechNet Guru can
    be found here:
    Calling All Wise Men! Windows
    Server Gurus Needed! Apply Within! No One Turned Away!
    Thanks for your informative post. :)
    Regards.
    Mahdi Tehrani   |  
      |  
    www.mahditehrani.ir
    Please click on Propose As Answer or to mark this post as
    and helpful for other people.
    This posting is provided AS-IS with no warranties, and confers no rights.
    How to query members of 'Local Administrators' group in all computers?

  • [Forum FAQ] How to show Windows Update in Control Panel in Clean Installation of Windows 10 Technical Preview Build 9926

    Scenario
    If you performed a clean installation of the new Windows 10 Technical Preview Build 9926, you would find Windows Update is only available in
    Settings and is hidden in Control Panel by default. However, Windows Update is still available in Control Panel if it is an upgrade version of Windows 10 Technical Preview Build 9926.
    Solution
    After the comparison of the two different version, the differences is the following registry:
    HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\IsConvergedUpdateStackEnabled
    In clean installation version:
    In upgrade version:
    The method to make Windows Update show in Control Panel in the clean installation of Windows 10 Technical Preview Build 9926:
    Edit the REG_DWORD value of IsConvergedUpdateStackEnabled from 1 to 0.
    Applies to
    Clean installation of Windows 10 Technical Preview Build 9926
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    We’ve seen a few forum posts talking about changing registry keys to alter the update experience we shipped in Technical Preview build 9926. There are a couple of reasons that we don’t recommend doing things like that.
    First, the default experience is what we’ve tested across not just the Windows 10 team, but across all of Microsoft before we released it to you. That doesn’t mean that you won’t still find bugs, but it’s definitely the code that’s been most thoroughly
    tested. Changing things back to older versions is risky because the combination of those old settings with the rest of Windows 10 is not something that’s been validated or supported, so we can’t predict the side effects. It’s possible that changing registry
    settings related to update could cause a machine to no longer be able to get new updates or Technical Preview builds.
    The other reason to avoid changing the default update experience is that a lot of update-related code is actually being re-written in order to scale across the variety of different device types Windows 10 will support. Since Technical Previews are
    a work-in-progress, some code that may still be in build 9926 won’t actually ship in the final version of Windows 10 that we provide to all our customers, so trying to re-enable that code temporarily won’t provide a way to accurately assess Windows 10’s update
    capabilities.
    We want to hear your feedback! We’re sharing Technical Preview releases early so we can understand exactly how customers are using our software and make sure we are designing our experiences to address those scenarios. The more
    specific the feedback, the more helpful it is for us – saying “I hate the new Windows Update UI” isn’t very useful, but when we see “I need to be able to tell Windows Update to grab updates from WU itself and not from my internal corporate server, so the new
    Windows Update UI is painful for me”, we can actually understand what changes we could make to solve those specific problems. We can’t promise to fix everything that everyone asks for – and sometimes what one customer wants is exactly what another customer
    doesn’t want – but the more you can help us understand why you want something changed, the better we can try to meet those needs.
    Thanks for listening, and we look forward to hearing your responses.
    http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_update/warning-disabling-the-new-windows-update-ui-may/dc846517-eca0-4960-b0ff-1eb7227223f5

  • [Forum FAQ] How do I have Invoke-SqlCmd return a date value without adding time

    Introduction
    A select statement executed from Invoke-SqlCmd returns a value from a Date column, the value has "12:00:00 AM" appended.  The same select statement executed within SQL Server Management Studio displays the date properly without any time formatting.
    Sample data is as follows:
    How to have Invoke-SqlCmd return Date values without adding time for multiple Date type columns and pipe the output into CSV file?
    Solution
    In SQL Server 2012 or onwards, use the FORMAT() function to convert datetime values to date format when executing query from Invoke-SqlCmd. In earlier versions such as SQL Server 2008 R2, use the traditional CONVERT() function to format datetime values to
    different date formats(yyyy.mm.dd, mm/dd/yyyy, etc) when executing query from Invoke-SqlCmd. Then pipe the output of SQL query result into CSV file by specifying export-csv parameter. An example is as follows.
    Create a table named “Test_invokesqlcmd” that contains Date type columns in SQL Server.
    USE Test
    Go
    CREATE TABLE [dbo].[Test_invokesqlcmd](
        [id] [int] NOT NULL,
        [name] [varchar](20) NULL,
        [test1] [date] NULL,
        [test2] [date] NULL
    ) ON [PRIMARY]
    GO
    insert into [dbo].[Test_invokesqlcmd]
    values(1,'David','2014-10-15','2015-01-07'),(2,'Jane','2011-08-05','2012-11-7'),(3,'Crystal','2013-09-15','2010-02-24')
    Define a query string, execute it from Invoke-SqlCmd and save the query result to a CSV file.
    Scripts for SQL Server 2012:
    $query1 = @"
        use Test;
        SELECT FORMAT(test1,'d') as newtest1, FORMAT(test2,'d') as newtest2 from dbo.Test_invokesqlcmd
    write-host $query1
    Invoke-Sqlcmd -Query $query1 -ServerInstance localhost | export-csv -notypeinformation -path c:\Files\test.csv
    Scripts for SQL Server 2008 R2:
    $query2 = @"
        Use Test;
        SELECT CONVERT(varchar, test1, 102) as newtest1,CONVERT(varchar, test2, 102) as newtest2
        FROM dbo. Test_invokesqlcmd
    write-host $query2
    Invoke-Sqlcmd -Query $query2 -ServerInstance localhost | export-csv -notypeinformation -path c:\Files\test.csv
    Check the results in SQL Server PowerShell window and csv file.
    SQL Server 2012:
    SQL Server 2008 R2:
    Reference
    Using the Invoke-Sqlcmd cmdlet
    SQL Server Functions that helps to convert date and time values to and from string literals and other date and time formats
    Applies to
    SQL Server 2014
    SQL Server 2012
    SQL Server 2008 R2
    SQL Server 2008
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Cross posted. More appropriate in JSF forum so continue conversation there.
    http://forum.java.sun.com/thread.jspa?threadID=717292&messageID=4142615#4142615

  • [Forum FAQ] How do I create calculated measure using AMO in SQL Server Analysis Services?

    Introduction
    In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
    In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
    Prerequisites
    Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
    The multidimensional database AdventureWorks Multidimensional Model 2012
    A SQL Server with SSIS and SSAS installed
    The AMO libraries installed:
    X86 Package (SQL_AS_AMO.msi)
    X64 Package (SQL_AS_AMO.msi)
    Solution
    Here is the detail steps to create calculated measure using AMO in SSAS.
    Open SSDT and create a new SSIS project.
    Drag Script Task to the design surface.
    Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
    Create a connection to connect to SSAS server.
    Rename the connection name to ssas.
    Double click the Script Task to open Script Task Editor.
    Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
    Add AMO reference in the Solution Explore window.
    Copy the script below and paste it into the script.
    Dim objServer As Server
    Dim objDatabase As Database
    Dim strDataBaseID As String
    Dim objCube As Cube
    Dim objMdxScript As MdxScript
    Dim objCommand As Command
    Dim strCommand As String
    objServer = New Server
    objServer.Connect("localhost")
    objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
    strDataBaseID = objDatabase.ID
    If objDatabase.Cubes.Count > 0 Then
    objCube = objDatabase.Cubes("Adventure Works")
    If objCube.MdxScripts.Count > 0 Then
    objMdxScript = objCube.MdxScripts("MdxScript")
    objMdxScript = objCube.MdxScripts(0)
    Else
    objCube.MdxScripts.Add("MdxScript", "MdxScript")
    objMdxScript = objCube.MdxScripts("MdxScript")
    End If
    objCommand = New Command
    strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
    strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
    strCommand = strCommand & " VISIBLE = 1 ; "
    objCommand.Text = strCommand
    objMdxScript.Commands.Add(objCommand)
    objMdxScript.Update()
    objCube.Update()
    End If
    objServer.Disconnect()
    Then you can run this SSIS package to create the calculated measure.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • [Forum FAQ] How to find and replace text strings in the shapes in Excel using Windows PowerShell

    Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
    shapes in Excel Object.
    Since the Excel.Application
    is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
    interact with Excel document.
    The figure below is an excel file:
    Figure 1.
    You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
    $text = “text1”,”text2”,”text3”,”text3”
    $Excel 
    = New-Object -ComObject Excel.Application
    $Excel.visible = $true
    $Workbook 
    = $Excel.workbooks.open("d:\shape.xlsx")      
    #Open the excel file
    $Worksheet 
    = $Workbook.Worksheets.Item("shapes")       
    #Open the worksheet named "shapes"
    $shape = $Worksheet.Shapes      
    # Get all the shapes
    $i=0      
    # This number is used to replace the text in sequence as the variable “$text”
    Foreach ($sh in $shape){
    $sh.TextFrame.Characters().text  
    # Get the textbox in the shape
    $sh.TextFrame.Characters().text = 
    $text[$i++]       
    #Change the value of the textbox in the shape one by one
    $WorkBook.Save()              
    #Save workbook in excel
    $WorkBook.Close()             
    #Close workbook in excel
    [void]$excel.quit()           
    #Quit Excel
    Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
    Besides, we can also find the documents about these methods and properties in MSDN:
    Workbook.Worksheets Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
    Worksheet.Shapes Property:
    http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
    Shape.TextFrame Property:
    http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
    TextFrame.Characters Method (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
    Characters.Text Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
    After running the script above, we can see the changes in the figure below:
    Figure 2.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thank you for the information, but does this thread really need to be stuck to the top of the forum?
    If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
    EDIT: I see this is no longer stuck to the top of the forum, thank you.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

Maybe you are looking for