SQL 2012 not recognizing modification of scalar function

I have two scalar functions which are both very similar. Both required three variables. Then I realized that I needed another variable in both functions so I added it to both.  I then modified the call to each function (e.g. select dbo.function(var1,
var2, var3, var4)), but within Management Studio editor, only the change in the first function is recognized. Below is the function that is not recognized and the call to it.  The error is 'insufficient number of arguments'.  Its as if Management
Studio doesn't realize I made the change.
ALTER FUNCTION [dbo].[InvoicePaidLateInFull](@Invoice bigint, @DueDate datetime, @Total decimal(14, 4), @EndDate datetime)
RETURNS bit
AS
BEGIN
DECLARE @PaidLate bit, @Paydate datetime, @Amount decimal(14, 4)
declare @Check int, @CurrentStatus bigint
declare @AmtTol decimal(14,4), @CID bigint
Set @PaidLate = 0
Set @CurrentStatus = (Select top 1 StatusID from RebateData Where InvoiceNo = @Invoice order by ID)
if @CurrentStatus <> 1
Begin
Goto NotDueYet
End
Set @CID = (Select top 1 CID from RebateData Where InvoiceNo = @Invoice order by ID)
Set @AmtTol = (Select AmountTolerance from MasterCustomerProgramContracts where ID = @CID)
If datediff(dd, @DueDate, @EndDate) < 0
Begin
GoTo NotDueYet
End
Set @Check = (Select count(*) from Payments Where InvoiceNo = @Invoice)
if @Check = 0
Begin
--No payments have been received at all. Consider as 'Unpaid'
GoTo NotDueYet
End
Set @Amount = isnull((Select round(sum(Amount) , 2)
from Payments
where invoiceno = @Invoice
and PayDate <= @DueDate
Group by InvoiceNo), 0)
Set @Amount = -(@Amount)
If @Amount between (@Total - (@Total * @AmtTol)) and (@Total + (@Total * @AmtTol))
Begin
Set @PaidLate = 0
End
If @Amount < (@Total - (@Total * @AmtTol))
Begin
Set @PaidLate = 1
End
NotDueYet:
RETURN @PaidLate
END
The Call:
Set @PL = (Select dbo.InvoicePaidLateInFull(@Inv, @DueDate, @Total, @EndDate))
Seems like I read the other day of a script that can be run to 'update' SQL, but I can't remember it now.
Thanks.
Ross

Leaving the Intellisense issue, permit me to point out that incorrectly used, this function can be a performance killer. An occasional call - no problem. But if you do something like:
SELECT ..., dbo.InvoicePaidLateInFull(invoice_id, due_date) AS PaidLade
FROM   MillionRowTable
This is a performance disaster. SQL Server cannot optimize the function, so you will have a cursor in disguise.
Overall, you should be very restrictive with scalar functions that perfoms data access.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Sql type not recognized: 'int unsigned' when I expand table in Dreamweaver

    Dreamweaver warning message - "sql type not recognized: 'int
    unsigned'"
    This was happening in Dreamweaver MX and now in CS3. The
    pages using these tables are not throwing errors when I test them,
    but each time I expand a table in Dreamweaver, I get these warning
    messages. Often I get the same message multiple times and must
    click OK each time before I can proceed. Just now I had to OK the
    warning three times for a table that only has one integer field and
    two fields total.
    Any help would be greatly appreciated.
    Thanks

    Hi Bagger and Ken
    With some help from Randy Edmunds at Adobe was able to find a
    solution to this bug.
    *note I am still using DW MX 2004 so there may be some
    variation with your version.
    ANSWER: You need to add the sql type "int unsigned" to the
    dwscriptsServer.js in Dreamweaver's files.
    The file to ammend is [your path to the DW
    root]\Configuration\Shared\Common\Scripts\
    dwscriptsServer.js
    do a search for the alert: "MM.MSG_SQLTypeAsNumNotInMap" and
    then go up from there (it is about line 2059 in the DW MX 2004
    file).
    underneath a["unsignedint"] = 19;
    add a new line a["int unsigned"] = 19; // variation of
    unsigned int
    I then deleted the delete the FileCache.dat (from step #4
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19105)
    and restarted DW.
    That should fix it!
    If that doesn't work then search the DW folders for
    "MM.MSG_SQLTypeAsNumNotInMap" and ammend the sql data types where
    the functions raise the error alert.
    I hope this is helpful!
    Cheers
    Martin
    ps I would be using the CS3 web premium suite if it wasn't
    for the fact that the UK upgrade price is (£539) - >US$1000
    which is more then double what US customers pay. (OK my whinge
    over, boo hoo)

  • SQL type not recognized: 'double unsigned'

    I have a particular table that uses fields defined as "double
    unsinged". Every time I expand that table in the database area, I
    get the error "SQL type not recognized: 'double unsigned'".
    Is this a bug or is it some odd configuration error on my
    part?

    Hi there
    See
    this
    thread on configuring sql types

  • CDC for Oracle in SQL 2012 not writing updates

    Hello...
    I have set up a CDC for Oracle Service and Instance for use with SQL 2012.  After the instance was started, I inserted six rows of data into my Oracle table and a few minutes later, it looks like the changes were picked up by the service.
    The instance status page contains the following information:
    Status = Green Checkmark
    Detailed Status = PROCESSING
    Last Transaction Timestamp = 7/22/2014 12:11:56 PM
    Last Change Timestamp = 7/22/2014 11:58:35 AM
    Transaction Log Head Change Number = 0x0A2C1C...
    Transaction Log Tail Change Number = 0x0A2C1C... (not the same value as the head)
    Current Change Number = 0x0A2C1C...
    Active Transactions = 1
    Staged Transactions = 0
    Completed Transactions = 0
    Written Changes = 0
    Read Changes = 6
    It looks like the six rows have been read, but they are not being written to cdc.CDC_TEST_TABLE_CT on my SQL 2012 database.
    I exported the diagnostic data using the "Collect Diagnostics" link, but there are no errors in the log.  Is there a primer for how to read the results of the diagnostics?
    I had the following error earlier today:
    "ORACDC517E:Oracle Call Intreface (OCI) method failed: ORA-01291: missing logfile 
    ORA-06512: at "SYS.DBMS_LOGMNR"
    But that error was resolved when my Oracle account was granted DBA and "execute_catalog_role" permissions.
    The account being used for the CDC Service and Instance has dbo rights on the SQL Server.
    Does anyone have an idea what the problem could be?
    Any help would be greatly appreciated.
    Thanks!

    Arthur, thank you for responding.  I appreciate it! :)
    I followed the instructions from Rakesh Parida's video on Technet.  Below are the individual steps I followed for creating the CDC Service and Instance.
    CDC Service Setup:
    I made sure that supplemental logging was enabled on my Oracle server.  I also made sure that my Windows account had DBA and "execute_catalog_role" permissions on the Oracle database.
    From the CDC Service Config MMC I ran Action>Prepare SQL Server which created the MSXDBCDC database.
    I then ran Action>New Service and entered the following information:
    Service name: OracleCDCService1
    Service Account: "This Account" radio button with my Windows username and password information
    Associated SQL Server: <My SQL 2012 Server>
    Authentication: Windows authentication
    I also provided a CDC Service master password.
    CDC Instance Setup:
    Connected to <My SQL 2012 Server> using the CDC Designer MMC
    Went through the steps of creating the Oracle CDC Instance
    Oracle CDC Instance Name = CDC_TEST_SOURCE
    Connected to my Oracle DB using Windows authentication
    Selected a single table that I wanted to try CDC on and left CDC Gating Role blank
    Ran the Oracle Logging script that enables table logging and supplemental log groups on the Oracle DB
    Ran the Status Check step and all passed
    Finished the wizard and started the instance
    A few minutes after the instance was started I added six records to the table in Oracle.
    Please let me know if you need more info.
    Thanks!

  • MOSS 2007 native mode on SQL 2012 with compatibility mode?

    We are on MOSS 2007 SP 3 64-bit (just native, it is not SSRS integration mode) running on SQL 2008 R2 SP2 64-bit. Can the databases move to SQL 2012 with compatibility mode?

    Hi,
    As far as I know, SQL 2012 is not listed as compatible with SharePoint 2007 on the
    technet articles. If you want to upgrade to SharePoint 2010, then you can move the databases and upgrade the database. If you just want to use SQL 2012 with SharePoint 2007, I think it is not applicable.
    For more information, please refer to these sites:
    SQL Server 2012 not supported on WSS 3.0/MOSS 2007 and versions previous than SharePoint 2010 SP1:
    http://blogs.msdn.com/b/calvarro/archive/2012/04/27/sql-2012-not-supported-on-wss-3-0-moss-2007.aspx
    SQL Server 2012 support:
    http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/02fd7238-9cc2-43fc-a46c-afbfca21210b
    Thanks,
    Entan Ming
    TechNet Subscriber Support in forum
    If you have any feedback on our support, please [email protected]
    Entan Ming
    TechNet Community Support
    Will it work with the database set with the compatibility mode ?
    /* Server Support Specialist */

  • SQL Svr 2012 / SharePoint 2013 "Install-SPRSService is not recognized..."

    Greetings --
    I'm having a heck of a time trying to get Reporting Services integrated with SharePoint 2013.  The end result is that no matter what I try, I keep getting the "The term 'Install-SPRSService' is not recognized as the name of a cmdlet" error
    which thereby prevents me from finalizing the integration with SP 2013.
    Following is a description of my lab + the steps I've followed to try to resolve:
    In a virtual environment with 3 machines, I have one set as the Domain Controller, one with SQL Server 2012 installed (no reporting services), one with SharePoint Server 2013.
    The domain is working fine... no problems there.  SQL Server 2012 is working fine... I can connect to it locally and remotely, execute commands, etc.
    On the SharePoint 2013 machine, I have tried two ways... 1) install SharePoint 2013 first, then install SQL Server requirements... 2) install SQL Server requirements first, then SharePoint 2013.
    In both methods, I am installing both "Reporting Services - SharePoint" and "Reporting Services Add-in for SharePoint Products" on the same machine as SharePoint Server 2013.
    My understanding was that when SP is installed first, the SQL Server installation should auto-register the necessary components (meaning running Install-SPRSService and ServiceProxy are not required). However, in this scenario, this doesn't appear to
    have happened.  The service does not appear at all within SharePoint.  Attempting to run "Install-SPRSService" fails with the "not recognized" error.
    In the second scenario (Installing SQL Server components first, then SharePoint second), it is my understanding that the "Install-SPRSService and Install-SPRSServiceProxy" must be run manually. With both SQL Server components and SharePoint 2013
    successfully installed, running "Install-SPRSService" fails with the "not recognized" error.
    I would also like to point out that I am executing the Install command from the "SharePoint 2013 Mangement Shell" (right clicking and running as Administrator). 
    Any suggestions or nuggets-of-wisdom would be GREATLY appreciated!

    Hi,
    I had the same issue when installing SSRS in SharePoint integrated mode. I had SharePoint management Shell opened, installed SQL binaries and then tried to run command Install-SPRSService
    and Install-SPRSServiceProxy. I got the same errors.
    But then I thought, if assemblies for SharePoint are loaded when Management Shell is opened, the assemblies were not
    there when I opened PowerShell. So I just closed Management Shell, opened it again and everything worked as expected.
    Hope it helps
    Robi MCT Kompas Xnet d.o.o. Ljubljana | blog: http://xblogs.kompas-xnet.si | website: http://www.kompas-xnet.si
    Slovenia
    Please vote if you find reply useful or mark it as answer.
    Thank you

  • SQL 2012 SP1 not recognized by CM 2012 CU2+

    Hi there,
    I am currently attempting to install and configure the System Center 2012 R2 Configuration Manager onto a Windows 2012 (6.3.9600) server using SQL 2012 SP1, however when I attempt to link it to the database in the CM Install panel, it informs me that I must
    link it to one of several versions of SQL that is compatible.  It directly lists SQL 2012 SP1 as an acceptable version.
    My current SQL version is 11.0.3349.0 (11.0.3---.- being SP1).  The instance, FQDN, and database name are correct but this error presents every time.  
    So breakdown is below:
    -With Instance it presents with a connection error
    -Without Instance it presents with a SQL Version error
    -Account has SQL admin access
    -Server is not using dynamic ports
    -Firewall is disabled for testing purposes
    Is there something I am missing?

    Define "Account has SQL admin access"?
    That statement is ambiguous at best. The exact requirement is that the account you are using to run setup must both be a local admin on the system hosting the SQL Instance and must be a sysadm in that SQL Instance. The two requirements are very different
    things.
    Are you trying to use a non-default instance? If so, I'm assuming it's also not listening on port 1433. In this case, you must enable the SQL Browser service so that the non-default SQL Instance can be found.
    Is there a specific reason you are using a non-default, remote instance of SQL Server?
    Jason | http://blog.configmgrftw.com

  • SQL 2012 and later will fail to publish a database for any tables with a default constraint that references a user defined function.

    Script will create database, 3 database objects and publish. 
    The error is due to the generation script to create the conflict tables that is not stripping out default constraints that reference a UDF. 
    As you can see below, the failure is on the generation script for the conflict table.
    The conflict table should be a bucket table that shouldn’t enforce data integrity. 
    See how the default constraints for the columns someint and somestring were stripped out of the generation logic however the default constraint that utilizes a UDF persist and uses the same object name that was used on the production table (The
    bold line) , this occurs if I explicitly name the constraint or let the system generate the name for me like in the example posted. 
      The only way I could see getting around this right now is to drop all default constraints in the system that uses a UDF, publish then add the constraints back which is vulnerable to invalid data and a lot of moving
    steps.  This all worked with SQL 2000, 2005, 2008, 2008r2, it’s stopped working in SQL 2012 and continues to not work in SQL 2014. 
    Error messages:
    Message: There is already an object named 'DF__repTable__id__117F9D94' in the database.
    Could not create constraint. See previous errors.
    Command Text: CREATE TABLE [dbo].[MSmerge_conflict_MergeRepFailurePublication_repTable](
            [id] [varchar](8) NULL CONSTRAINT [DF__repTable__id__117F9D94]  DEFAULT ([dbo].[repUDF]()),
            [somedata] [varchar](64) NULL,
            [rowguid] [uniqueidentifier] ROWGUIDCOL  NULL,
            [someint] [int] NULL,
            [somestring] [varchar](64) NULL
    Parameters:
    Stack:    at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
       at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
       at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
       at Microsoft.SqlServer.Replication.Snapshot.YukonMergeConflictTableScriptingManager.ApplyBaseConflictTableScriptToPublisherIfNeeded(String strConflictScriptPath)
       at Microsoft.SqlServer.Replication.Snapshot.BaseMergeConflictTableScriptingManager.DoConflictTableScriptingTransaction(SqlConnection connection)
       at Microsoft.SqlServer.Replication.RetryableSqlServerTransactionManager.ExecuteTransaction(Boolean bLeaveTransactionOpen)
       at Microsoft.SqlServer.Replication.Snapshot.BaseMergeConflictTableScriptingManager.DoConflictTableScripting()
       at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateTableArticleCftScript(Scripter scripter, BaseArticleWrapper articleWrapper, Table smoTable)
       at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateTableArticleScripts(ArticleScriptingBundle articleScriptingBundle)
       at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateArticleScripts(ArticleScriptingBundle articleScriptingBundle)
       at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateObjectScripts(ArticleScriptingBundle articleScriptingBundle)
       at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()
       at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()
       at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoScripting()
       at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
       at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
       at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: 2714)
    Get help: http://help/2714
    Server COL-PCANINOW540\SQL2012, Level 16, State 0, Procedure , Line 1
    Could not create constraint. See previous errors. (Source: MSSQLServer, Error number: 1750)
    Get help: http://help/1750
    Server COL-PCANINOW540\SQL2012, Level 16, State 0, Procedure , Line 1
    Could not create constraint. See previous errors. (Source: MSSQLServer, Error number: 1750)
    Get help: http://help/1750
    Pauly C
    USE [master]
    GO
    CREATE DATABASE [MergeRepFailure]
    ALTER DATABASE [MergeRepFailure] SET COMPATIBILITY_LEVEL = 110
    GO
    USE [MergeRepFailure]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    create view
    [dbo].[repView] as select right(newid(),8) as id
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE FUNCTION [dbo].[repUDF]()
    RETURNS varchar(8)
    BEGIN
    declare @val varchar(8)
    select top 1 @val = id from [repView]
    return @val
    END
    GO
    create table repTable
    id varchar(8) default([dbo].[repUDF]()),
    somedata varchar(64) null,
    rowguid uniqueidentifier ROWGUIDCOL default(newid()),
    someint int default(1),
    somestring varchar(64) default('somestringvalue')
    GO
    insert into reptable (somedata) values ('whatever1')
    insert into reptable (somedata) values ('whatever2')
    go
    /*test to make sure function is working*/
    select * from reptable
    GO
    /*Publish database*/
    use [MergeRepFailure]
    exec sp_replicationdboption @dbname = N'MergeRepFailure', @optname = N'merge publish', @value = N'true'
    GO
    declare @Descrip nvarchar(128)
    select @Descrip = 'Merge publication of database ''MergeRepFailure'' from Publisher ''' + @@servername +'''.'
    print @Descrip
    -- Adding the merge publication
    use [MergeRepFailure]
    exec sp_addmergepublication @publication = N'MergeRepFailurePublication', @description = N'@Descrip',
    @sync_mode = N'native', @retention = 14, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true',
    @enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21,
    @ftp_subdirectory = N'ftp', @ftp_login = N'anonymous', @allow_subscription_copy = N'false', @add_to_active_directory = N'false',
    @dynamic_filters = N'false', @conflict_retention = 14, @keep_partition_changes = N'false', @allow_synctoalternate = N'false',
    @max_concurrent_merge = 0, @max_concurrent_dynamic_snapshots = 0, @use_partition_groups = null, @publication_compatibility_level = N'100RTM',
    @replicate_ddl = 1, @allow_subscriber_initiated_snapshot = N'false', @allow_web_synchronization = N'false', @allow_partition_realignment = N'true',
    @retention_period_unit = N'days', @conflict_logging = N'both', @automatic_reinitialization_policy = 0
    GO
    exec sp_addpublication_snapshot @publication = N'MergeRepFailurePublication', @frequency_type = 4, @frequency_interval = 14, @frequency_relative_interval = 1,
    @frequency_recurrence_factor = 0, @frequency_subday = 1, @frequency_subday_interval = 5, @active_start_time_of_day = 500, @active_end_time_of_day = 235959,
    @active_start_date = 0, @active_end_date = 0, @job_login = null, @job_password = null, @publisher_security_mode = 1
    use [MergeRepFailure]
    exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repTable', @source_owner = N'dbo', @source_object = N'repTable', @type = N'table',
    @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000010C034FD1, @identityrangemanagementoption = N'manual',
    @destination_owner = N'dbo', @force_reinit_subscription = 1, @column_tracking = N'false', @subset_filterclause = null, @vertical_partition = N'false',
    @verify_resolver_signature = 1, @allow_interactive_resolver = N'false', @fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0,
    @delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'false', @partition_options = 0
    GO
    use [MergeRepFailure]
    exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repView', @source_owner = N'dbo', @source_object = N'repView',
    @type = N'view schema only', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x0000000008000001,
    @destination_owner = N'dbo', @destination_object = N'repView', @force_reinit_subscription = 1
    GO
    use [MergeRepFailure]
    exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repUDF', @source_owner = N'dbo', @source_object = N'repUDF',
    @type = N'func schema only', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x0000000008000001,
    @destination_owner = N'dbo', @destination_object = N'repUDF', @force_reinit_subscription = 1
    GO

    More information, after running a profile trace the following 2 statements, the column with the default on a UDF returns a row while the other default does not.  This might be the cause of this bug.  Is the same logic to generate the object on
    the subscriber used to generate the conflict table?  
    exec sp_executesql N'
    select so.name, schema_name(so.schema_id)
    from sys.sql_dependencies d
    inner join sys.objects so
    on d.referenced_major_id = so.object_id
    where so.type in (''FN'', ''FS'', ''FT'', ''TF'', ''IF'')
    and d.class in (0,1)
    and d.referenced_major_id <> object_id(@base_table, ''U'')
    and d.object_id = object_id(@constraint, ''D'')',N'@base_table nvarchar(517),@constraint nvarchar(517)',@base_table=N'[dbo].[repTable]',@constraint=N'[dbo].[DF__repTable__id__117F9D94]'
    exec sp_executesql N'
    select so.name, schema_name(so.schema_id)
    from sys.sql_dependencies d
    inner join sys.objects so
    on d.referenced_major_id = so.object_id
    where so.type in (''FN'', ''FS'', ''FT'', ''TF'', ''IF'')
    and d.class in (0,1)
    and d.referenced_major_id <> object_id(@base_table, ''U'')
    and d.object_id = object_id(@constraint, ''D'')',N'@base_table nvarchar(517),@constraint nvarchar(517)',@base_table=N'[dbo].[repTable]',@constraint=N'[dbo].[DF__repTable__somein__1367E606]'
    Pauly C

  • External Isight camera & 2012 Macbook Pro not recognized

    Hello,
    External Isight camera connected to 2012 Macbook Pro through Firewire.  Green light on camera comes on but camera is not recognized in Photo Booth or FaceTime.  Also does not show up in hardware.
    Hope someone can help, Dan

    How to test your iSight to ensure it is functional
    How to Troubleshoot iSight
    Message was edited by: EZ Jim
    Mac OSX 10.10.1

  • AX Dynamics 2012 Reporting Service Extension Error - The user or gorup name is not recognized

    Hi,
    I am currently installing AX Dynamics 2012 Reporting Service Extension on one of our machine. But this always fails during the installation with this error:
    DynamicsSetupLog
    Our current domain is MWSerp
    An error occurred while adding users AxERP\qaproxy, AxERP\qaaos, MWSerp\qaproxy to the SQL Server Reporting Services DynamicsAXBrowser role in the folder dynamicsAX. The error is: The user or group name AxERP\qaproxy is not recognized.
    The database was restored from our old Ax Deployment on a different domain - AxERP if you noticed on the error, 2 domains are present: AxERP (old domain) and MWSerp (our existing).
    I find it peculiar that it is still adding old accounts from the old domain which is not existent. Tried looking for it on the registry or on the AX Dynamics User account but there are no entries on AxERP\qaaos and AxERP\qaproxy on it.
    Do you have any clue on where AX Installer is picking up those information which needs to be added on the DynamicsAXBrowser? Tried stopping /starting the AOS Service and generating WCF. Also tried looking on registry but couldnt find it. How can I bypass
    it so the Extension will be installed successfully. I also tried not deploying the reports, just the Extension only.
    Regards,

    I'd ask them here.
    http://community.dynamics.com/product/ax/f/33.aspx
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • SQL Server not functional after Windows Sysprep

    Hello!
    I sysprep generalized a full configured Windows Server 2012 Standard copy with SQL Server 2012 configured on it but not set up using the sysprep prepare method. I only want to generalize the windows copy but have the SQL install work as previously configured.
     After i boot back into the server after the generalize finishes i am unable to access the SQL server using windows authentication even after i changed the computer name and use the same user accounts as before. I have seen the sysprep prepare for imaging
    documentation for syspreping an SQL instance however i already have SQL installed and i just want to migrate this install to newer hardware. Does anyone have any advice for this? Thank you.  

    Hello Kabitokaii,
    It seems that sql server is not recognizing your new computer name. Since your new name is different from the name when SQL Server has been installed, you have to change the also in sys.servers.... 
    you can query the name by submitting the following statement: (once you´re told you can´t connect only with windows autentication, i`m assumin that you can connect with SQL Server autentication.)
    SELECT * FROM SYS.SERVERS.
    If the names are different (from SYS.SERVERS to current machine name), you have to change is, following the bellow steps:
    http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/
    Steps to rename SQL Server
     Execute the below commands for each instance on the machine.
    -- for a Default Instance
    sp_dropserver <old_physical_server_name>
    GO
    sp_addserver <new_name>, local
    GO
    --for a Named Instance
    sp_dropserver <'old_physical_server_name\instancename'>
    GO
    sp_addserver <'new_name\instancename'>, local
    GO
    </new_name></old_physical_server_name>
     Restart the SQL Server services.
     Execute the below query in each instance to verify the updated system metadata.
    SELECT @@SERVERNAME
    Edvaldo Castro http://edvaldocastro.com MCITP Database Administrator on SQL Server® 2008 MCITP Database Administrator on SQL Server® 2005 MCTS: SQL Server® 2008 MCTS: SQL Server® 2005 MCT: Microsoft Certified Trainer MTA: Microsoft Technology Associate
    MTAC – Microsoft Technical Audience Contributor CCSQLA – Cambridge Certified SQL Associate TOEIC – Test of English for International Communication

  • Term is not recognized when executing PowerShell Script through SQL Agent using CMDEXEC

    I am trying to simply execute a PowerShell script that is stored in a file on a network drive through SQL Agent as a job. The script is a basic copy from one directory to another.  I have run and successfully executed this from a command prompt outside
    of SQL Agent.  When I execute this through SQL Agent as a Operating System (CmdExec) command I am getting an error that the term is not recognized as the name of a cmdleet, function, script file or operable program. I have executed many different ways
    put found an article to use double quotes in the network path which I have done with no success. 
    I am executing the following command as a job in SQL Agent:
    PowerShell H:\"\PowerShell""\PS_Scripts\"\batchcopyFFLWithProgress.ps1 through SQL Agent job
    I get the following error message:
     04/21/2015 10:01:09,Copy FFL Files,Error,1,NY11266-LTW7E\JPLAPTOPSQL,Copy FFL Files,Copy FFL files,,Executed as user: NT Service\SQLAgent$JPLAPTOPSQL. H:\PowerShell\PS_Scripts\batchcopyFFLWithProgress.ps1 : The term   'H:\PowerShell\PS_Scripts\batchcopyFFLWithProgress.ps1'
    is not recognized as   the name of a cmdlet<c/> function<c/> script file<c/> or operable program. Check the   spelling of the name<c/> or if a path was included<c/> verify that the path is   correct and try again.
     At line:1 char:1  + H:"\PowerShell\PS_Scripts"\batchcopyFFLWithProgress.ps1  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      + CategoryInfo          : ObjectNotFound:
    (H:\PowerShell\P...ithProgress.p      s1:String) []<c/> CommandNotFoundException      + FullyQualifiedErrorId : CommandNotFoundException.  Process Exit Code 1.  The step failed.,00:00:03,0,0,,,,0
    Content of batchcopyFFLWithProgress.ps1 which has the PowerShell script:
    $source=ls H:\SQLTest\Script\TestData\*.*
    $i=1
    $source| %{
        [int]$percent = $i / $source.count * 100
        Write-Progress -Activity "Copying ... ($percent %)" -status $_ -PercentComplete $percent -verbose
        copy $_.fullName -Destination H:\test -Recurse
        $i++
    I have searched the internet and have not found any resolution to my error.  If someone has experienced this error and found the resolution I would greatly appreciate your help.

    I have change the service account for SQL Agent to be my domain account as I have local admin rights to my laptop.  I stopped and started the services for SQL Agent and than started the job to run which is copying locally to minimize any network drive
    issues.  I am still getting the same error message as it is showing that I am executing the job under my domain account?  Any thoughts what it could be?
    ErrorMsg
    04/23/2015 11:21:06,Copy FFL Files,Error,1,ServerName\InstanceName,Copy FFL Files,Copy FFL files,,Executed as user: Domain\DomainAccount. \\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1 : The term '\\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1'
    is   not recognized as the name of a cmdlet<c/> function<c/> script file<c/> or operable program. Check the spelling of the name<c/> or if a path was   included<c/> verify that the path is correct and try again.  At
    line:1 char:1  + \\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      + CategoryInfo          : ObjectNotFound: (\\ServerName...ithProgress.ps1:String)
    []<c/> CommandNotFoundException      + FullyQualifiedErrorId : CommandNotFoundException.  Process Exit Code 1.  The step failed.,00:00:02,0,0,,,,0
    Script
    $source=ls "\\ServerName\Test\TestData\*.*"
    $i=1
    $source| %{
        [int]$percent = $i / $source.count * 100
        Write-Progress -Activity "Copying ... ($percent %)" -status $_ -PercentComplete $percent -verbose
        copy $_.fullName -Destination "\\ServerName\Test\test" -Recurse
        $i++

  • Object reference not set to an instance of an object. Unable to finish the SQL 2012 installation on a VM Machine

    Hi, My name is Leonard and I am studying SQL. I have downloaded the newest MS SQL 2012 and also MS 2012 Hyper-V. I have set a MS 2012 Hyper-V on a laptop with AMD Turion 64 X2 and 3G of RAM (Planing
    to add more to max at 8G).
    Following the instructions in the free online
    Administering Microsoft SQL Server 2012 Databases” Training Kit, I have set 6 virtual machines as instructed in the Training Kit. While the installation of the MS Server Core 2008 R2 SP1 completed with no
    problem, the same cannot be said for the SQL Server 2012 installation. I have encountered an error that I have not seen anyone address in any of the SQL web forums.
    After running the unattended setup instruction (Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine /INSTANCENAME=MSSQLSERVER
    /SQLSVCACCOUNT="Njowa\Pa$$worD>" /SQLSVCPASSWORD=" Pa$$worD” /SQLSYSADMINACCOUNTS="Njowa\lenny#4!@" /AGTSVCACCOUNT="NT AUTHORITY\Network Service"
     /IACCEPTSQLSERVERLICENSETERMS) this is what I get after a series SQL setup
     initiation windows popups then disappears.
    The following error occurred:
    Object reference not set to an instance of an object.
    Error result: -2147467261
    Result facility Code: 0
    Result error Code: 16387
    Please review the summary.txt log for further details
    My question is: What instance of an object is not properly initialize in the Setup instructions

    Hello,
    Please note that SQL Server requires at least 1 GB of RAM. The operating system (Windows Server) requires 2 GB of RAM (recommended) or 512 MB (minimum). This means any virtual machine that will receive the installation of a SQL Server instance requires 1.5
    or 2 GB at least.
    The behavior of SQL Server setup tells me that the virtual machine does not have enough memory assigned or .NET Framework 3.5 was not enable on Control Panel->Program
    and Features before trying to install SQL Server.
    The following thread is about another possible cause of this error:
    http://social.msdn.microsoft.com/Forums/mr-IN/sqlsetupandupgrade/thread/575d3025-69f5-4152-a473-44496b008811
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • "The certificate chain was issued by an authority that is not trusted" when migrating to SQL 2012

    Environment:
    1 Primary Site (USSCCM-Site.domain.com)
    1 CAS (USSCCM-CAS.domain.com)
    SQL 2008 R2 (USSCCM-CAS.domain.com)
    SQL 2012 SP1 CU6 (USSQL12.domain.com)
    Issue:
    We were successfully able to migrate the CAS to the new SQL 2012 server, almost without incident. When attempting to migrate the Site instance however, we are getting errors. Screenshot below.
    Attached is a copy of the log. But below is a highlight of what I think are the errors… It appears that either SQL or SCCM doesn’t like a certificate somewhere, but it is contradicting because the logs say that it has successfully tested connection to SQL.
    I am lost.
    Logs stating it can connect successfully to SQL
    Machine certificate has been created successfully on server USSQL12.domain.com.        Configuration Manager Setup                10/21/2013 10:20:10
    AM               2100 (0x0834)
    Deinstalled service SMS_SERVER_BOOTSTRAP_USSCCM-Site.domain.com_SMS_SQL_SERVER on USSQL12.domain.com.  Configuration Manager Setup    10/21/2013 10:20:10 AM              
    2100 (0x0834)
    SQL Server instance [sccmsite] is already running under the certificate with thumbprint[f671be844bf39dec7e7fdd725dc30e225991f28a].       Configuration Manager Setup    10/21/2013 10:20:10 AM        
    2100 (0x0834)
    INFO: Testing SQL Server [USSQL12.domain.com] connection ...                Configuration Manager Setup    10/21/2013 10:20:10 AM      
    2100 (0x0834)
    INFO: SQL Connection succeeded. Connection: USSQL12.domain.com SCCMSITE\MASTER, Type: Unsecure                Configuration Manager Setup    10/21/2013 10:20:10 AM              
    2100 (0x0834)
    INFO: Tested SQL Server [USSQL12.domain.com] connection successfully.  Any preceding SQL connection errors may be safely ignored.            Configuration Manager Setup    10/21/2013
    10:20:10 AM               2100 (0x0834)
    INFO: Certificate: 308202FC308201E4A003020102021011BA47041BB0609D4097BC19F5AB96B5300D06092A864886F70D01010B0500301D311B301906035504031312555353514C31322E7063756265642E636F6D3020170D3133313031373139343632345A180F32313133303932343139343632345A301D311B301906035504031312555353514C31322E7063756265642E636F6D30820122300D06092A864886F70D01010105000382010F003082010A0282010100CFAC23CEA8920051C8C24DF4E96D76D9E034931867C4DBF74F8AE863C5BDE6D1EAEAAF363F6B97DEF1D7A1FC292CB870F353D72F04472EBE3D31DCA009BD3F8C58E2AAB69C892C20598306537F5EEAA43FA6DE55D4A784CEB6FD07486AB2CC2DE1A8651648EBC31A5CD918E8ED6E184FC560B3A8B0F76F83E310BBA8C4EB27F46707E3A6377D8DD06C6808146E407EF9DB464F453798B6C1748216665884A7F2CDE03D9DA1CB4E59E67516E4F345755E35450F84F4B039642851EFFA96B22D8E77EC11C01D389989F740923B58799E34FC8F4F19CD55830FA7E786C993A08A1EEDCA87F209268CE9D5E86AC9E2A14668207721D94ACE9FACE3AA55B53507F6BF0203010001A3363034301D0603551D11041630148212555353514C31322E7063756265642E636F6D30130603551D25040C300A06082B06010505070301300D06092A864886F70D01010B05000382010100A0E33BF490B60C2B8A73BF7FA90EBB69D92DA27B439EF0569650F388EBA34B9F382CEF52DAAB543C2924E1B8DC7BEE828FB0C276330B0FF67340CBFA0CC24F47431E5272DC76C7610C290A04411036441E9822FBF8AB52B4BBE43F5FF48074BA420FF690A94D53AFCEF7AC75E2D2723520A9EF64AF06759814AE92D41CEA2F0D6CC8D9E5DEF121234F5DD97A7E886BE55F57DC0B79052A554724E8A0146C08A74AE75672FBD8C8BD6B7FCA82C1CC69906A45128CDDD1BC3985ED9603C16E712FFBAA8AA6878F853367F3E1F69E727DB96864DF6B47EBDA82659036EC82A8B04E77535CEA314D7518D02C401969C77B91C8C210C57AA991A622D679B994AEED3C               
    Configuration Manager Setup    10/21/2013 10:20:10 AM               2100 (0x0834)
    INFO: Created SQL Server machine certificate for Server [USSQL12.domain.com] successfully.    Configuration Manager Setup 10/21/2013 10:20:10 AM               2100 (0x0834)
    INFO: Configuration Manager Setup - Application Shutdown       Configuration Manager Setup    10/21/2013 10:20:10 AM         2100 (0x0834)
    INFO: Running SQL Server test query.    Configuration Manager Setup    10/21/2013 10:20:10 AM               2100 (0x0834)
    INFO: SQL Connection succeeded. Connection: USSQL12.domain.com SCCMSITE\MASTER, Type: Secure                Configuration Manager Setup    10/21/2013 10:20:10 AM              
    2100 (0x0834)
    INFO: SQL Server Test query succeeded.              Configuration Manager Setup    10/21/2013 10:20:10 AM              
    2100 (0x0834)
    INFO: SQLInstance Name: sccmsite         Configuration Manager Setup    10/21/2013 10:20:10 AM               2100 (0x0834)
    INFO: SQL Server version detected is 11.0, 11.0.3381.0 (SP1).      Configuration Manager Setup    10/21/2013 10:20:10 AM         2100 (0x0834)
    Logs saying certificate is not trusted
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:20:49 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:20:49
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:20:49 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:20:49 AM              
    2100 (0x0834)
    INFO: SQL Connection failed. Connection: CCAR_DB_ACCESS, Type: Secure         Configuration Manager Setup                10/21/2013 10:20:49
    AM               2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:20:52 AM              
    2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:20:52 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:20:52
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:20:52 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:20:52 AM              
    2100 (0x0834)
    INFO: SQL Connection failed. Connection: CCAR_DB_ACCESS, Type: Secure         Configuration Manager Setup                10/21/2013 10:20:52
    AM               2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:20:55 AM              
    2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:20:55 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:20:55
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:20:55 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:20:55 AM              
    2100 (0x0834)
    INFO: SQL Connection failed. Connection: CCAR_DB_ACCESS, Type: Secure         Configuration Manager Setup                10/21/2013 10:20:55
    AM               2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:20:58 AM              
    2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:20:58 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:20:58
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:20:58 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:20:58 AM              
    2100 (0x0834)
    INFO: SQL Connection failed. Connection: CCAR_DB_ACCESS, Type: Secure         Configuration Manager Setup                10/21/2013 10:20:58
    AM               2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:21:01 AM              
    2100 (0x0834)
    More logs saying cert is not trusted
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:21:20 AM              
    2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:21:20 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:21:20
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:21:20 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:21:20 AM              
    2100 (0x0834)
    INFO: Updated the site control information on the SQL Server USSQL12.domain.com.    Configuration Manager Setup                10/21/2013 10:21:39 AM              
    2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted. Configuration Manager Setup    10/21/2013 10:21:39 AM              
    2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]SSL Provider: The certificate chain was issued by an authority that is not trusted.        Configuration Manager Setup   
    10/21/2013 10:21:39 AM                2100 (0x0834)
    *** [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection                Configuration Manager Setup    10/21/2013 10:21:39
    AM               2100 (0x0834)
    ERROR: SQL Server error: [08001][-2146893019][Microsoft][SQL Server Native Client 11.0]Client unable to establish connection         Configuration Manager Setup    10/21/2013 10:21:39 AM              
    2100 (0x0834)
    *** Failed to connect to the SQL Server, connection type: CCAR_DB_ACCESS.    Configuration Manager Setup                10/21/2013 10:21:39 AM              
    2100 (0x0834)
    CSiteSettings::WriteActualSCFToDatabase: Failed to get SQL connection                Configuration Manager Setup               
    10/21/2013 10:21:39 AM               2100 (0x0834)
    CSiteSettings::WriteActualSCFToDatabaseForNewSite: WriteActualSCFToDatabase(USA) returns 0x87D20002                Configuration Manager Setup    10/21/2013 10:21:39
    AM               2100 (0x0834)
    ERROR: Failed to insert the recovery site control image to the parent database. Configuration Manager Setup                10/21/2013 10:21:39 AM              
    2100 (0x0834)
    Troubleshooting:
    I have read on a few articles of other people having this issue that states to find the certificate on SQL 2012 that’s being used and export it to the SCCM server – which I’ve done.
    http://damianflynn.com/2012/08/22/sccm-2012-and-sql-certificates/
    http://trevorsullivan.net/2013/05/16/configmgr-2012-sp1-remote-sql-connectivity-problem/
    http://scug.be/sccm/2012/09/19/configmgr-2012-rtm-sp1-and-remote-management-points-not-healthy-when-running-configmgr-db-on-a-sql-cluster/
    -Brad

    Hi,
    How about importing certificate in the personal folder under SQL server computer account into SCCM server computer account or SCCM server service account? That certificate is for SQL Server Identification. And you could
    set the value of the ForceEncryption option to NO. (SQL Server Configuration Manager->SQL Server Network Configuration->
    Protocols for <server instance>->Properties)
    Best Regards,
    Joyce Li
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Intermittent : The term 'get-date' is not recognized as the name of a cmdlet, function, script file, or operable program.

    I have developed a batch harness whereby all scheduled tasks (W2012) invoke a common powershell script that acts as a wrapper to all our housekeeping jobs.
    The first step in the wrapper is to create a Transcript file using following code
    if ($Host.name -ne "Windows PowerShell ISE Host") # Transcript does not work within ISE
    $timestamp = (get-date -format "yyyy-MM-dd-HH-mm-ss.fff")
    $path = "c:\corp\$timestamp" + "_$pid.txt"
    Start-Transcript -path $path -append
    As expected the folder contains files with timestamp & pid in name
    08/08/2013  11:00 AM            14,388 2013-08-08-11-00-01.158_1620.txt
    08/08/2013  11:00 AM            12,506 2013-08-08-11-00-01.485_936.txt
    08/08/2013  11:00 AM            12,994 2013-08-08-11-00-01.735_9328.txt
    08/08/2013  11:00 AM            12,024 2013-08-08-11-00-01.766_8624.txt
    08/08/2013  11:00 AM            13,902 2013-08-08-11-00-01.860_1756.txt
    08/08/2013  11:01 AM            15,142 2013-08-08-11-01-31.392_10120.txt
    08/08/2013  05:00 AM            14,982 _1692.txt
    However note the last file, it has a zero length date time value in the name
    The error recorded by PowerShell is
    get-date : The term 'get-date' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At C:\Corp\Powershell\DMPRun-ScheduledTask.ps1:171 char:18
    +    $timestamp = (get-date -format "yyyy-MM-dd-HH-mm-ss.fff")
    +                  ~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (get-date:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    IE get-date has failed and returned a zero length field as the timestamp
    Can anyone think of a good reason why get-date would fail intermittently?
    Do I have to code defensively for base Powershell functions?

    I implemented David's suggestion and now I intermittently get
    import-module : Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
    At D:\temp\loop_jc2_2013_11_25_08_55_02.ps1:15 char:1
    + import-module Microsoft.Powershell.Utility
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Import-Module], UnauthorizedA
       ccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow
       erShell.Commands.ImportModuleCommand
    I added a trap chain (My Powershell skills do not yet include recursive trap coding, any suggestions welcome)
    trap {
        trap {
            "Trap1"
            "Exception: " + $_
            "Error: " + $Error[0]
            "Message: " + $_.Exception.Message
            "InnerException: " + $_.Exception.InnerException
            "StackTrace: " + $_.Exception.StackTrace
            "FailedItem: " + $_.Exception.ItemName
            import-module Microsoft.Powershell.Management
            import-module Microsoft.Powershell.Security
            import-module Microsoft.Powershell.Utility
        "Trap2"
        "Exception: " + $_
        "Error: " + $Error[0]
        "Message: " + $_.Exception.Message
        "InnerException: " + $_.Exception.InnerException
        "StackTrace: " + $_.Exception.StackTrace
        "FailedItem: " + $_.Exception.ItemName
        import-module Microsoft.Powershell.Management
        import-module Microsoft.Powershell.Security
        import-module Microsoft.Powershell.Utility
    import-module Microsoft.Powershell.Management
    import-module Microsoft.Powershell.Security
    import-module Microsoft.Powershell.Utility
    trap {
        "Trap3"
        "Exception: " + $_
        "Error: " + $Error[0]
        "Message: " + $_.Exception.Message
        "InnerException: " + $_.Exception.InnerException
        "StackTrace: " + $_.Exception.StackTrace
        "FailedItem: " + $_.Exception.ItemName
        exit 1
    get-date
    Now I intermittently get ..
    Trap2
    Exception: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
    Error: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
    Message: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
    InnerException:
    StackTrace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)
       at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
       at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew)
       at System.Management.Automation.AnalysisCache.CacheExportedCommands(PSModuleInfo module, Boolean force, ExecutionContext context)
       at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, Boolean found, IEnumerable`1 modulePath, String name, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags,
    PSModuleInfo& module)
       at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
       at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
       at System.Management.Automation.CommandProcessor.ProcessRecord()
    FailedItem:
    import-module : Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
    At D:\temp\loop_jc2_2013_11_25_09_19_52.ps1:26 char:1
    + import-module Microsoft.Powershell.Security
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Import-Module], UnauthorizedA
       ccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow
       erShell.Commands.ImportModuleCommand

Maybe you are looking for

  • TS1702 How do I delete an old Apple ID?

    When I attempt to update my Apps the password window pops up but my Apple ID displays a discontinued email adresss no longer in use. I've reset, updated and signed off of my Apple ID but nothing changes and the old email address keeps popping up.  Ho

  • Query regarding sftp adapter

    Hi Is there any way we can use dynamic configuration with sftp adapter ? Requirement is that I need to retrieve input file name and use that somewhere but for sftp sender I could not locate adapter specific message attributes. Does that mean its impo

  • How To Build Your Own Audit Rules in Jdeveloper 11.1.2.0.0 ?.

    Hi All, I am using Jdeveloper 11.1.2.0.0. I followed below link:    http://www.oracle.com/technetwork/developer-tools/jdev/index-098707.html#01But in this link ,they are explained about how to creating our own audit rule in Jdeveloper 10g. How to cre

  • My mac mini suddenly went into a grey screen and doesnt respond

    My mac mini doesnt respond to anything, i try changing screens but they  do the same thing

  • Changing PR request date

    Hi all, When we create a PR in the PR line item 'Quantities/Dates' tab the request date field gets the system date. i.e The date on which PR line item is created. Now let us take that a PR contains five line items. And I am creating the PR on 08/10/2