Power shell script failed to run - reasons for it and some background?

Hi there
I have been receiving some alerts with high repeat count that Powershell script failed to run.
All of them are coming from one server and all of them are related to SQL2012 installation. The following scripts generate alerts:
CPUUsagePercentDataSource.ps1
StolenServerMemory2012.ps1
DBDiskLatencyDataSource.ps1
I am quite new to SCOM and still trying to find my way around conveniently - I would appreciate your help if you could explain me one thing: are these scripts executed locally or through remote PSSession to the target? The point is I couldn't find any of
these scripts on my server to re-run them (and possibly catch exceptions).
The repeat count for past two months is quite high, for 8 alerts between 25 / 80.
Thanks in advance!
AlexP

The agent downloads the script and it is run locally on the agent machine, in your case the SQL Server. Usually most of these type scripts are held in the Agent folder under scritp/downloads, (sorry dont have the full path in front of me or I would give
it to you).
These errors are probably due to the fact that SQL 2012 does not give any rights to the Local System Account which is the context in which the SCOM agent runs scripts as, and is unable to access SQL information due to this fact. The easiest way to fix this
is to setup a run as account, which would be an account on your domain that has local admin access to the SQL box and has SA rights to the instance of SqL running on that box. See the following blog posts on how to fix this.
http://blogs.technet.com/b/kevinholman/archive/2010/09/08/configuring-run-as-accounts-and-profiles-in-r2-a-sql-management-pack-example.aspx
Hope this helps! this will probably create more questions...
Scott Moss MVP (Operations Manager) President - System Center Virtual Users Group |Vice President - Atlanta Southeast Management Users Group (ATL SMUG)
Please remember to click “Mark as Answer” on the post that helps you!
my new blog om2012.wordpress.com

Similar Messages

  • Intermittent "Power Shell Script failed to run" after installing SQL MP 6.5.4.0

    We recently installed the SQL MP.  One thing I am struggling with is this "Power Shell Script failed to run" that occasionally comes up, but, not always on the same server, and not always at the same time. 
    It says it ran past the configured timeout of 300 seconds. 
    The post that seemed to have me on the right track was
    https://social.technet.microsoft.com/Forums/en-US/c539a55d-dd48-438f-b7d5-06ed2cecf6e9/powershell-script-failed-to-run-alerts-from-sql-management-pack-6410?forum=operationsmanagergeneral
    However, even after getting one of the several scripts that have been generating the error, out of the extract management pack, it has parameters that need to be fed to it that I have no idea what they are....
    Example.  ActiveRequestsDataSource.ps1 requires $computername, $connectionstring, $tcpport, $sql_wmi_namespace, and $servicename. 
    The computername is easy enough...  so is tcpport.  but, the others... not so much. 
    I am fairly certain I will be able to run these manually, if I just knew the parameters...  I am also fairly certain we are getting these because at the time of the check, resources on that server are tied up for one reason or another. 
    Can someone please help?  This is killing me. 

    Hi,
    As this issue happens after you installing SQL MP, so from my point of view, it seems like caused by the runas account for the SQL MP is not configured well, I would like to suggest you follow the article below to configure runas account for the management
    pack:
    Configuring Run As Accounts and Profiles in OpsMgr – A SQL Management Pack Example
    http://blogs.technet.com/b/kevinholman/archive/2010/09/08/configuring-run-as-accounts-and-profiles-in-r2-a-sql-management-pack-example.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Power Shell Script failed to run - GetMGAlertsCount.ps1

    Our SCOM 2012 R2 is getting the following script error every 45 minutes...
    The PowerShell script failed with below exception
    System.Management.Automation.PropertyNotFoundException: The property 'Name' cannot be found on this object. Verify that the property exists.At line:57 char:3
    + $firstLvlClass = Get-SCOMClass -Id $firstLvlMember.Name
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at CallSite.Target(Closure , CallSite , Object )
    at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
    at CallSite.Target(Closure , CallSite , Object )
    at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    Script Name: GetMGAlertsCount.ps1
    One or more workflows were affected by this.
    Workflow name: ManagementGroupCollectionAlertsCountRule
    Instance name: All Management Servers Resource Pool
    Instance ID: {4932D8F0-C8E2-2F4B-288E-3ED98A340B9F}
    Management group: NCA2
    On the management server seeing corresponding 22406 errors
    System
    Provider
    [ Name]
    Health Service Modules
    EventID
    22406
    [ Qualifiers]
    49152
    Level
    2
    Task
    0
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2015-04-21T18:44:03.000000000Z
    EventRecordID
    1303964
    Channel
    Operations Manager
    Computer
    PKSWSM001.ad.nca.com
    Security
    EventData
    NCA2
    ManagementGroupCollectionAlertsCountRule
    All Management Servers Resource Pool
    {4932D8F0-C8E2-2F4B-288E-3ED98A340B9F}
    GetMGAlertsCount.ps1
    300
    System.Management.Automation.PropertyNotFoundException: The property 'Name' cannot be found on this object. Verify that the property exists.At line:57 char:3 + $firstLvlClass = Get-SCOMClass -Id $firstLvlMember.Name
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at CallSite.Target(Closure , CallSite , Object ) at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame
    frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    System.Management.Automation.PropertyNotFoundException
    I'm at a bit of a loss to troubleshoot this error.  I cannot find the "GetMGAlertsCount.ps1"  script to execute manually and don't have much else I can find to troubleshoot.
    Thanks for your help!

    1) Please check Event Log on the management server and see if there are any related errors.
    Nothing
    interesting found
    2) On the management server, please ensure the following key exists:
    HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup\Powershell\V2
    Two entries found underneath this key;
    (Default) (value not set)
    InstallDirectory C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\
    3) Action Account has access to the resources used by the PowerShell script.
    is LocalSystem
    4) Make sure that the computer is not over utilized.
    No indication of overutilization
    Thank you for the suggestions!  Do you know of anything else to check?

  • Power Shell Script failed to run

    Hi
    I think this alert is due to a faulty management pack, specifically in the module mentioned. I'm trying to investigate further. We have this on multiple
    servers and across different roles. 
    How do I get access to this script so I can find out what it is timing out on? Where's the output of this script kept? 
    I'm still new to SCOM2012 and think while its and improvement its still got bugs left over from 2007.
    Alert description: Forced to terminate the following PowerShell script because it ran past the configured timeout 300 seconds.
    Script Name:    CheckMaxConcurrentAPI.ps1
    One or more workflows were affected by this.
    Workflow name: Microsoft.Windows.Server.2008.MaxConcurrentAPI.Monitor
    Instance name: Microsoft Windows Server 2008 R2 Enterprise
    Instance ID: {81CDE473-D76E-3459-58B1-5DB67AC6B574}
    Management group: OM2012

    This workflow came from Windows Server 2008 Max Concurrent API Monitor.
    The most likey cause of tmeout is due to permission issue.
    Please make sure that your default action account has the following right on local mcahine
    • Member of the local users group
    • Member of the local Performance Monitor Users group
    • Granted Log On Locally rights
    Beside, you can find the script on
    SCOM 2012 R2
    c:\Program Files\Micosoft Monitoring Agent\Agent\Health Service state
    SCOM 2012
    c:\program Files\System Center Operations Manager\Agent\Health Service state
    Roger

  • SCOM 2012 SP1 - PowerShell Script failed to run - 3 alerts appear after every reboot of the SCOM Server

    Brand new SCOM 2012 SP1 install with Update Rollup 1 applied
    Single server, local SQL install, SQL Server 2012 SP1
    Hyper-V VM running on Server 2012.  VM has 8GB Ram, single vCPU
    Going through initial management pack importing and configuration, at this point I have the Windows Server 2012 and SQL 2012 MP's installed.
    See screenshot
    http://i.imgur.com/l0Molh1.png
    I am getting the following alerts in my SCOM console and cannot find a resolution to fix the issue.  I don't want to set an override, as an override will prevent the PowerShell alert in other instances, where I might want to receive an alert.
    Looking at the alert description, it states "The Data Access service is either not running or not yet initialized"
    The SCOM Console launches and responds fine, and I get no other errors.  I check the Data Access service and it is online.  I have left the system alone for a couple of hours and no other errors.  I then closed those alerts and restarted the
    server, and they came right back in, so I know that this is something that is happening at either server startup of during the start of the SCOM services.
    Is it possible that SCOM is trying to execute these scripts and the Data Access service has not come online yet?
    Has anyone else come across this before?

    Please try the method in the following thread:
    Note: As there is operations related to Registry, please perform a backup before doing this.
    OpsMgr 2012 - Power Shell Script failed to run 
    http://social.technet.microsoft.com/Forums/de-DE/systemcenterde/thread/4be37f8d-1e7b-450c-8cb9-f1e95f3b2bd0/
    Thanks.
    Nicholas Li
    TechNet Community Support

  • SQL MP script failed to run

    Hi! I have installed the SQL MP 6.5.1.0 for SQL2005,SQL2008,SQL2012 and SQL2014. I know that I need to use one SQL RunAsAccount and add that account in the SQL RunAsProfiles to have the correct access to run the SCOM SQL scripts and get the correct
    monitoring. We have give this SQL RunAsAccount the "Local Administrator" and "sysadmin" rights on all instances through a group. This SQL servers also use UAC, then we tested to add this SQL RunAsAccount directly with sysadmin
    rights on one SQL servers instances instead through a group. But still the same problem... I haven't test the new SQL MP version 6.5.4.0 yet and I know that there is one fix for "Fixed
    Timeout error in CPU utilization monitoring scenario"
    The SQL RunAsAccount use "More Secure" and we are running the SQL RunAsProfiles target type against a Group with "Windows Computers" for all the SQL servers that we want to run this RunAsAccount against. We have the same problem
    when we tested to change the target type to "SQL Computers" 
    At most of our customer it works fine but at one customer we still get all this SQL monitor related errors:
    Power Shell Script failed to run (timeout 200 sec)
            - scriptname=CPUUsagePercentDataSource.ps1
            - workflow=Microsoft.SQLServer.2008DBEngine.ThreadsCountMonitor
    Operations Manager failed to start a process
           - command=GetSQL2008DBWinServStat.js
           - workflow=Microsoft.SQLServer.2008.Database.ServiceMonitor
    Operations Manager failed to start a process due to lack of Resources
           - command=GetSQL2012DBFreeSpace.vbs
    Operations Manager failed to run a WMI Query
             - workflow=Microsoft.SQLServer.2012.Database.ServiceMonitor
    Someone with any idea what's the problem can be?

    Hi,
    >At most of our customer it works fine but at one customer we still get all this SQL monitor related errors
    Do you mean only one SQL server has this error message poped out? If that is the case, then you may check whether the runas account configured has proper permissions on that server. You may add the account to local admin group.
    Please also go through the link below:
    http://blogs.technet.com/b/kevinholman/archive/2013/10/24/opsmgr-sql-mp-version-6-4-1-0-capabilities-and-configuration.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Trying to run program off network location using GPO with Power shell script.

    Hello All,
    Not much of a script writer. I am giving it a shot.  My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
    to run the program with elevated privileges. 
    Little background:
    We are running on a domain and end users do not have admin rights.
    The application is stored on a share on our network that is open to all domain users.
    The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
    So this is what I have so far.
    $username = "USER"
    $password = "PASSWORD"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
    But for some reason I keep getting :
    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:10 char:1
    + Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    Any help you could give would be great.
    Thanks,
    jdfmonkey

    Hi jdfmonkey,
    Has anyone provided an answer to your original question?  I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
    $cred=Get-Credential
    start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
    I get the same error that you mentioned:
    start-process : This command cannot be run due to the error: The system cannot find the file specified.
    At C:\Scripts\Process.ps1:2 char:1
    + start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    When I leave off the credentials:
    start-processProcess.exe-WorkingDirectoryC:\Scripts
    It works correctly.  Does anyone have a solution to make this work correctly?
    Please ask your own question.  You issue is nothing like the current thread.  You clearly are using a user account that has no access to the folder.  It is a permissions issue.  It is not a scripting issue.
    If you need further help please start your own question.
    ¯\_(ツ)_/¯

  • Trying to run Power shell Script on task schedule

    My case is i'm trying to run a power shell script through the task schedule.
    Note if i run the script locally it is working fine but from the task schedule it is not working.
    More information: 
    script function: Password Change Notification
    Task name : test3
    Time to do the task: 9:08 am every day
    the status : running 
    .ps1 file location: under C\windows\system32\
    some actions in the task history after the dated time to run:
    1 Task Scheduler launched "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}"  instance of task "\test3" due to a time trigger condition
    2 Task Engine "S-1-5-21-60622444-1628707926-2526327935-500: enviroment\Admin:S4U:LUA"  received a message from Task Scheduler service requesting to launch task "\test3" .
    3 Task Scheduler started "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}" instance of the "\test3" task for user "enviroment\admin
    4 Task Scheduler launched action ""C:\Windows\System32\Password Change Notification\Password Change Notification.ps1"" in instance "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}" of task "\test3
    5 Task Scheduler launch task "\test3" , instance "C:\Windows\System32\notepad.exe"  with process ID 5052

    Hi MeipoXu,
    First of all i would like to thank you for your answer, i followed the URL that you posted already in the previous comment and unfortunately it didn't work, and please find my ps1 file
    content as typed below and give me your feedback on that.
    #  # Version 1.1 May 2014
    # Robert Pearman (WSSMB MVP) # TitleRequired.com
    # Script to Automated Email Reminders when Users Passwords due to Expire.
    # # Requires: Windows PowerShell Module for Active Directory
    # # For assistance and ideas, visit the TechNet Gallery Q&A Page. http://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27/view/Discussions#content
    # Please Configure the following variables....
    $smtpServer="outlook. myDomain " $expireindays = 7
    $from = "الدعم الفني
    <ITHelpDesk@myDomain>"
    $logging = "Enabled" # Set to Disabled to Disable Logging
    $logFile = "PassExpireNotlog.csv" # ie. c:\mylog.csv
    $testing = "Enabled" ## "Enabled" # Set to Disabled to Email Users
    $testRecipient = "MyEmail@MyDomain"
    $encoding = [System.Text.Encoding]::Unicode $date = Get-Date -format ddMMyyyy
    # Check Logging Settings if (($logging) -eq "Enabled")
    {     # Test Log File Path
        $logfilePath = (Test-Path $logFile)     if (($logFilePath) -ne "True")
        {         # Create CSV File and Headers
            New-Item $logfile -ItemType File
            Add-Content $logfile "Date,Name,EmailAddress,DaystoExpire,ExpiresOn,MsgBody"
        } } # End Logging Check
    # Get Users From AD who are Enabled, Passwords Expire and are Not Currently Expired
    Import-Module ActiveDirectory $users = get-aduser -filter * -SearchScope Subtree -SearchBase "OU=UsersOU,DC=MyDomain,DC=MyrootDomain,DC=MYrootNS" -properties Name, PasswordNeverExpires, PasswordExpired, PasswordLastSet,
    EmailAddress |where {$_.Enabled -eq "True"} | where { $_.PasswordNeverExpires -eq $false } | where { $_.passwordexpired -eq $false }
    $maxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge
    # Process Each User for Password Expiry foreach ($user in $users)
    {     $Name = (Get-ADUser $user | foreach { $_.Name})
        $emailaddress = $user.emailaddress
        $passwordSetDate = (get-aduser $user -properties * | foreach { $_.PasswordLastSet })
        $PasswordPol = (Get-AduserResultantPasswordPolicy $user)
        # Check for Fine Grained Password
        if (($PasswordPol) -ne $null)     {
            $maxPasswordAge = ($PasswordPol).MaxPasswordAge
        $expireson = $passwordsetdate + $maxPasswordAge
        $today = (get-date)     $daystoexpire = (New-TimeSpan -Start $today -End $Expireson).Days
                 # Set Greeting based on Number of Days to Expiry.
        # Check Number of Days to Expiry
        $messageDays = $daystoexpire     if (($messageDays) -ge "2")
        {         $messageDays = "خلال
    " + "$daystoexpire" + " ايام"
        }     elseif (($messageDays) -eq "2")
        {         $messageDays = "خلال يومين
        }     else
        {         $messageDays = "اليوم."
        }     # Email Subject Set Here
        $subject="كلمة المرور الخاصة بك ستنتهي
    $messageDays"
           # Email Body Set Here, Note You can use HTML, including Images.
        $body =     "<P style='font-family: Arial; font-size: 16pt' />
        <center> الاستاذ/ $name
    </center> 
        <br>     <center>
    كلمة المرور الخاصة بك ستنتهي $messageDays </center>
        <br>     <center>
    نأمل تغييرها في أقرب فرصة حتي تتمكن من الدخول على النظام
    </center>
        <br>     <center>
    مع تحيات الادارة العامة لتقنية المعلومات
    </center> 
        <br>     </P>"
            # If Testing Is Enabled - Email Administrator
        if (($testing) -eq "Enabled")
        {         $emailaddress = $testRecipient
        } # End Testing     # If a user has no email address listed
        if (($emailaddress) -eq $null)
        {         $emailaddress = $testRecipient    
        }# End No Valid Email     # Send Email Message
        if (($daystoexpire -ge "0") -and ($daystoexpire -lt $expireindays))
        {          # If Logging is Enabled Log Details
            if (($logging) -eq "Enabled")
            {             Add-Content $logfile "$date,$Name,$emailaddress,$daystoExpire,$expireson,$body" 
            }         # Send Email Message
            Send-Mailmessage -smtpServer $smtpServer -from $from -to $emailaddress -subject $subject -body $body -bodyasHTML -priority High -Encoding $encoding
                    } # End Send Message
      } # End User Processing
    # End

  • Need Power shell script to run on all databases.

    Hi,
    I have a stored procedure to generate report, using power shell script want to get all databases, run stored procedure on each database and generate the results as .csv file, output the file with database name (place it on directory) and  email .csv
    file.
    looking for script, can any one help pls?
    Naveen| Press Yes if the post is useful.

    Can you please share with me the codes
    Naveen| Press Yes if the post is useful.
    Dear N_14
    You can have a look on the followings
    http://www.csharp-station.com/Tutorial/AdoDotNet/lesson07
    http://www.codeproject.com/Articles/415732/Reading-and-Writing-CSV-Files-in-Csharp
    https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage%28v=vs.110%29.aspx
    Best Regards
    mintssoul

  • Power shell script to run a Resuable workflow.

    Hi,
    We came across a scenario where we want to run a resuable workflow on all List items in a list. I am not sure if this can be acheived through power shell. Can any one please help me to run reusable workflows through power shell script on list items.
    Thanks,
    Sandy

    Hello,
    Recently i executed below script for my VS workflow on list items, you can also try same on reusable WF.
    Basically you need to use "WorkFlowManager" and "WorkFlowAssociations " to find WF on list and then execute it.
    http://www.mysharepointadventures.com/2012/06/start-a-workflow-using-powershell/
    http://www.thesysadminhimself.com/2013/09/sharepoint-start-workflow-all-items-powershell.html
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • HOW TO RUN POWER SHELL SCRIPT UNDER SAFE MODE

    hi
    is is possible to run the power shell script (with Management instrument code ) in safe mode
    if so then how to do it, please explain the procedure 

    Hi CHELLAPPA,
    Based on my research, we can use powershell in safe mode, and I also tested on server 2012 R2:
    You can also open cmd and type "powershell" to use powershell script.
    If there is anything else, please feel free to post back.
    Best Regards,
    Anna Wang

  • Power shell script for get a content db for a particular web application

    Hi
    what  is the power shell script for get a content db for a particular web application
    Get-SPDatabase 
    adil

    try this one
    Get-SPContentDatabase -webapplication http://url
    this will return all the database for the web applications.
    Get-SPContentDatabase -site http://contoso.com
    this will return the database name in which the contose site collection is.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Power Shell Script for Check Remote machinces are live or not

    I have required a Power Shell Script for Check multiple Remote machines are live or not.Please guide me

    This will do it.
    http://gallery.technet.microsoft.com/Ping-IP-Adress-Range-d90ce82d
    &#175;\_(ツ)_/&#175;

  • I need AD Health status via Power Shell script

    Dear All,
    I need AD Health power shell script and it has to be sent via email as report on daily basis
    Can anyone help on this?
    Thanks,
    Pushparaj

    I found below script which can be used, but i would request run these scirpts in test environment before executing in production.
    http://fearthemonkey.co.uk/using-powershell-to-perform-dc-health-checks/
    http://www.wolffhaven45.com/blog/powershell/automate-some-active-directory-health-checks-via-powershell/
    You can also search for scripts in below repository.
    http://gallery.technet.microsoft.com/
    Also, for scripting related request, its better to post the thread in dedicated scripting/powershell forum.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Awinish Vishwakarma - MVP
    My Blog: awinish.wordpress.com
    Disclaimer This posting is provided AS-IS with no warranties/guarantees and confers no rights.

  • How to execute power shell script file inside DSC script resource

    Hi,
    How to execute /call powershell scirpt file inside DSC script resource , some thing like below and capture the status of execution.
    Node $AllNodes.NodeName
    Script ExecuteSQLDeploy
    #SetScript = {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5" }
    #TestScript= {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5 }
    #GetScript= { return $true;}
    Basawaraj

    Thanks for reply. 
     Now i am able to execute the power shell script with DSC. I  am getting no error when i run , but the script logic wrote inside  ( deploying sql incremental changes ) not working . I am using SQLCMD in the powershell script to deploy sql
    changes . Can you please elaborate on "script is compatible with DSC" , the script
    should not contain write-host cmdlet.... etc something like that.
    Copying recursively from ****************************** to ************************** succeeded.
    Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
    An LCM method call arrived from computer ************ with user sid **********************************************
    [V-BAKANT]: LCM:  [ Start  Set      ]
    [V-BAKANT]: LCM:  [ Start  Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ Start  Test     ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Test     ]  [[Script]ExecuteSQLDeploy]  in 0.1110 seconds.
    [V-BAKANT]: LCM:  [ Start  Set      ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]  [[Script]ExecuteSQLDeploy]  in 0.3010 seconds.
    [V-BAKANT]: LCM:  [ End    Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]
    [V-BAKANT]: LCM:  [ End    Set      ]    in  0.8810 seconds.
    Operation 'Invoke CimMethod' complete.
    Time taken for configuration job to complete is 0.923 seconds
    Basawaraj

Maybe you are looking for

  • Development and Test on same machine

    Hi, In my current setup I have a development application, a test application and a production application. The dev. and test is on the same machine, with different APP ID's. Dev is 102, and test is 110 At first there was no problems with this. But no

  • MacBook Pro 15 Gaming Performance

    I Just got the latest macbook pro 15 inch base model for school and I want to play some games on it. I tried playing games like Prison Architect and Civilization Beyond Earth but about a couple minutes into the games, the laptop starts to get pretty

  • [SOLVED] dwm urxvt by default

    Hello, I installed Arch with dwm and i can't figure out how to change the default terminal to urxvt so that when i use alt+shift+enter it opens urxvt instead of xterm. I edited the config.h with urxvt but it doesn't work. What did i miss? Last edited

  • Compile error on errorID ?

    Start a new blank Flash 9/AS3 .fla in CS3, Type in this code : var _urlLoader:URLLoader = new URLLoader(); _urlLoader.addEventListener(IOErrorEvent.IO_ERROR, _onXMLIOError); function _onXMLIOError(e:IOErrorEvent):void trace("Error = " + e.errorID); T

  • Is it possible to set the database with nulls first for all its tables ?

    Hello, I have a schema of 117 tables and I would like Oracle to behave nulls first when doing any order by on any tables. Is there a way to tell that respectable old database server to do such a thing ? As it is today, I have to write some custom DAO