Monitor SQL Database mirroring using powershell script

I am trying use the below powershell script to monitor SQL Database mirroring. The motive here is to determine if there are databases which are in "Disconnected" or "Suspended" mode.
I am running the script on the Principal Server:
$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2
$returnStateUnknown = 3
$NagiosStatus = ""
# Load SMO extension
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
# Servers to check
$sqlservers = @("$env:computername");
foreach($server in $sqlservers)
$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $server;
# Get mirrored databases
$databases = $srv.Databases | Where-Object {$_.IsMirroringEnabled -eq $true -and $_.MirroringStatus -eq "Suspended" -or $_.MirroringStatus -eq "Synchronizing" -or $_.MirroringStatus -eq "Disconnected"
-or $_.MirroringStatus -eq "None"  -and $_.Name -ne "Master" -and $_.Name -ne "model" -and $_.Name -ne "msdb" -and $_.Name -ne "tempdb"};
if ($databases -ne $null)
$databases | Select-Object -Property Name, MirroringStatus | Format-Table -AutoSize;
exit $returnStateCritical
} Else {
Write-Host "All Databaes are Mirrored"
exit $returnStateOK
I have Suspended few databases for testing purpose but when I run the above script the output says "All Databaes are Mirrored"
If I make changes to $database and use it below i.e. I am changing the AND operator to OR after "$_.IsMirroringEnabled -eq $true"
$databases = $srv.Databases | Where-Object {$_.IsMirroringEnabled -eq $true -or $_.MirroringStatus -eq "Suspended" -or $_.MirroringStatus -eq "Synchronizing" -or $_.MirroringStatus
-eq "Disconnected" -or $_.MirroringStatus -eq "None"  -and $_.Name -ne "Master" -and $_.Name -ne "model" -and $_.Name -ne "msdb" -and $_.Name -ne "tempdb"};
I get the below output:
Name                                                                        
   MirroringStatus
DB1                                                                    
  Synchronized
DB2                                                                    
  Synchronized
DB3                                                                       Synchronized
DB4                                                                   
Suspended
DB5                                                                       Suspended
DB6                  
     Suspended
DB7                                                              
        Synchronized
DB8                                                              
        Synchronized
I only want the databases which are Suspended or Disconnected to be listed.

I only want the databases which are Suspended or Disconnected to be listed.
Hi raul-133,
Based on your description, to list the databases which are Suspended or Disconnected ,I recommend you execute the following Transact-SQL statements in SQL Server firstly. If you can get the expected results from this query, then use the SQL Server query
in powershell script. For more details, please review this similar blog:
Monitor database mirroring.
Use master
go
select d.name, m.mirroring_state_desc
from sys.database_mirroring m,
sys.databases d
where m.database_id = d.database_id and (m.mirroring_state in (0,1))
For more details about mirroring state, you can review this article:
sys.database_mirroring (Transact-SQL).
Thanks,
Lydia Zhang

Similar Messages

  • Changing a SQL Report server Database to a new One Using Powershell script

    Hi,
    I have an existing report server (Native Mode) and a pre-configured report server database. I have created a new database and want to assign it new report server database. How can i automate this process using powershell?
    Here is the detail requirement
    If there is a Report Server database seeded on the xxxxx server, follow the below steps:
    ◾Click the Database button on the left. Click on the Change Database button, choose option Choose an existing report server database. Enter the RPT server name (e.g. xxxxxx) in Server Name text box and click Next.
    ◾In the Report Server Database selection, select the ReportServer database. Then click next button to complete the process.
    Any help in this regard will be very much helpfull.
    Sushruta Banerjee

    Hi Sushruta,
    To query export from Report server Database, the scripts below may be helpful for you:
    Export RDL Files from ReportServer Database with PowerShell
    SQL Database Reports with PowerShell
    I hope this helps.

  • Is it possible to monitor State change of a .CSV file using powershell scripting ?

    Hi All,
    I just would like to know Is it possible to monitor State change of a .CSV file using powershell scripting ? We have SCOM tool which has that capability but there are some drawbacks in that for which we are not able to utilise that. So i would like
    to know is this possible using powershell.
    So if there is any number above 303 in the .CSV file then i need a email alert / notification for the same.
    Gautam.75801

    Hi Jrv,
    Thank you very much. I modified the above and it worked.
    Import-Csv C:\SCOM_Tasks\GCC2010Capacitymanagement\CapacityMgntData.csv | ?{$_.Mailboxes -gt 303} | Export-csv -path C:\SCOM_Tasks\Mbx_Above303.csv;
    Send-MailMessage -Attachments "C:\SCOM_Tasks\Mbx_Above303.csv" -To “[email protected]" -From “abc@xyz" -SMTPServer [email protected] -Subject “Mailboxex are above 303 in Exchange databases” -Body “Mailboxex are above 303 in Exchange databases" 
    Mailboxex - is the line which i want to monitor if the values there are above 303. And it will extract the lines with all above 303 to another CSV file and 2nd is a mail script to email me the same with the attachment of the 2nd extract.
    Gautam.75801

  • Using Powershell Script Run simple query in MS Access 2007 and export the results of query to Excel

    Hi Experts,
    I have a Access 2007 DB file and 2 Big tables inside that (bigger than the size that can be easily handled by MS Excel 2007).
    My requirement is automate using powershell scripts the below things.
    1. Create a SQL query in Access DB and save that in access DB
    2. Run the saved query and export the result in excel sheet where I can create the charts and Pivots. Thanks in advance
    Prajesh

    Do you have to use the Access query, couldn't you just recreate the query in Powershell?  Here's a link with good info that references an existing script for querying an Access database:
    http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/13/hey-scripting-guy-can-i-query-a-microsoft-access-database-with-a-windows-powershell-script.aspx
    Once you have your dataset you can pipe it to
    Export-Csv -NoType c:\pathtofile\output.csv

  • Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?

    Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?
      Now a days we are saving / extracting data in a excel spreadsheet, but we would like to do that using a database because it is better.

    You can use ODBC connection to work with SQL Server database.
    Use SQLExec object to execute the SQL statement. Here is a KB about the SQL statement.
    http://digital.ni.com/public.nsf/allkb/4ADEEA04CD24AE0B862565E20002A16F?OpenDocument
    To write data to spreadsheet is more straightforward because Lookout has built-in spreadsheet object. But you need to write SQL statement by yourself to interact with other database.
    To read the data back is the same way. Just use "select" SQL statement to query. You can use Datatable object to query.
    The "Data Source" can be "DSN = data source name;". The data source name is configured in Control Panel->Administrative Tools->Data Sources(ODBC).
    Ryan Shi
    National Instruments

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • How to set volume using Powershell script?

    I would like to know on how to set volume under Window 7 Home 64 bits system using Powershell script.
    Such as 8000 levels as default
    Does anyone have any suggestions?
    Thanks in advance for any suggestions
    Thanks in advance for any suggestions

    Try this.
    Function Set-SpeakerVolume{
    Param (
    [switch]$min,
    [switch]$max,
    [int]$Percent
    $wshShell = new-object -com wscript.shell
    If ($min){
    1..50 | % {$wshShell.SendKeys([char]174)}
    ElseIf ($max){
    1..50 | % {$wshShell.SendKeys([char]175)}
    elseif($Percent){
    1..50 | % {$wshShell.SendKeys([char]174)}
    1..($Percent/2) |% {$wshShell.SendKeys([char]175)}
    Else{
    $wshShell.SendKeys([char]173)
    This works in Windows 8.1.
    Stolen / Modified from
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/07/28/weekend-scripter-cheesy-script-to-set-speaker-volume.aspx, which took me 20 seconds of (apparently) lucky searching.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Windows 8.1 - How to enable "Require additional authentication at startup" for bitlocker using powershell script?

    I need help to do this using powershell scripts on Windows 8.1?
    OS : Windows 8.1 Enterprise
    TPM Chip : None
    Enabling bitlocker on OS drive with a password at boot time is a 2 step process.
    1) Edit the Group Policy (gpedit.msc) - Administrative Templates -> Windows Components -> BitLocker Drive Encryption -> Operating System Drives ->
    Require additional authentication at startup -> Allow bitlocker without a compatible TPM
    ref : http://www.7tutorials.com/how-enable-bitlocker-without-tpm-chip-windows-7-windows-8
    2) Enable Bitlocker on c driver using manage bitlocker snapin
    I need help to do this using powershell scripts?
    I researched on the forums but ran into an issue.
    I found that Group policy commandlets can be used to do step 1.  
    I am getting the error : "ins have been registered for Windows PowerShell version 4" when I try to do the following in windows 8.1
    Add-PSSnapin GroupPolicy
    Import-Module GroupPolicy -Verbose

    Hi TinkerBotFoo,
    I’m writing to just check in to see if the suggestions were helpful. If you need further help,
    please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards
    Anna
    TechNet Community Support
    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.

  • I have a infopath form and i want to publish this form using powershell script(No central admin usage) and i am using Infopath 2010.

    How to publish infopath form using powershell script in infopath 2010?
    Is any approach for such solution.

    Hi,
    Try below command:
    Uninstall the existing solution (based on the from file name):
    Uninstall-SPInfoPathFormTemplate -Identity Exampleform.xsn
    Install the new solution (based on the from file name):
    Install-SPInfoPathFormTemplate -Path C:\Form.xsn
    Disable feature on site collection level
    Disable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site http://SPSite
    Enable feature on site collection level
    Enable-SPInfoPathFormTemplate -Identity "Form.xsn" -Site "http://SPSite"
    See this blogs for your ref:
    http://rgielen.blogspot.in/2010/11/deploy-infopath-2010-forms-with.html
    http://mysharepointwork.blogspot.in/2010/09/deploy-infopath-forms-with-powershell.html
    Hope it could help
    Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • Get the daily incremental search crawl information using PowerShell script

    Dear Friends ,
        I want to get the daily incremental search crawl information using PowerShell script . I need this information into CSV or txt format . Can you please help me with this.
    valmiki

    Hi
    I  have got the below script which worked .
    ## SharePoint Reference
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search.Administration")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
    function global:Get-CrawlHistory($url)
    trap [Exception] {
    write-error $("ERROR: " + $_.Exception.GetType().FullName);
      write-error $("ERROR: " + $_.Exception.Message);
      continue;  
    $s =
    new-Object Microsoft.SharePoint.SPSite($url);
    $c = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($s);
    $h =
    new-Object Microsoft.Office.Server.Search.Administration.CrawlHistory($c);
    Write-OutPut $h.GetCrawlHistory();
    $s.Dispose();
    Get-CrawlHistory
    -url  http://your_site_url/
      |
    Export-CsvF:\temp\search.csv
    valmiki

  • How to insert the file name to the start and the end of a SQL file by a powershell script

    I just began to learn powershell script and I have a problem that I cannot figure out. I have a lot of .sql files. I need to insert its file name to the beginning of the file (After USE statement) and the end of the file (before the last END statement). Is
    there anybody knowing how to do this?
    Thanks so much
    Regards

    Actually, I want to add a insert SQL statement to the beginning of the file and the end of the file. Only the file name is a variable and different among
    different files. All the other sql statements are the same and can be hard coded. Hopefully it helps –
    The problem I think is that I want to add the same thing (except the file name) to hundreds of sql files and only the file name is different. I do not want
    to add it manually and want to use a script to add it – 

  • How to give readonly Permission rights to 1000 users with button using powershell script?

    $site = Get-SPSite
    -Identity "http://mysite/"
    $user = Get-SPUser
    -Identity "mydomain\myuser"
    -Web $site.RootWeb
    $assignment = New-Object
    Microsoft.SharePoint.SPRoleAssignment($user)
    $role = $site.RootWeb.RoleDefinitions[[Microsoft.SharePoint.SPRoleType]::Reader]
    $assignment.RoleDefinitionBindings.Add($role);
    foreach ($web in $site.AllWebs)
        if ($web.HasUniquePerm)
            $web.RoleAssignments.Add($assignment)
    With above script I can give Readonly permission to the users...but at a time I can give permission to only one user...Actually 1000 users requires these permissionMy requirement is I will have a textbox and a button.I will enter username in textbox
    and when i clicked button the required permission should be assigned to the user given in the textbox...can you please tell how can i achieve this........how make to run powershell script when button is clicked.

    Hello,
    Instead of applying security to user level, it'll be better to create a SharePoint group where you will add the users. and use the outof the box interface to give permissions.
    and for your button, just add the direct link to add user
    http://serverurl/_layouts/15/aclinv.aspx?GroupId=7&IsDlg=1 
    replacing the group ID by the id of your new group (you can see it in the url when your are in the group)
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • How to force group policy update remotely in a bunch of desktops(computers name in a textfile) by using powershell script?

    Hi,
    I want to force group policy on a collection of computers remotely.The name of computers can be stored in a text file.
    By using this info. (about computer names) , Could you please guide me writing a Powershell script for this.
    Thanks in advance.
    Daya

    This requires that PSRemoting is enabled in your environment.
    $Computers = Get-Content -Path 'C:\computers.txt'
    Invoke-Command -ComputerName $Computers -ScriptBlock {
    GPUpdate /Force

  • Sql Loader by using shell script, not able to insert data

    Hi,
    I am trying to dump the data by using shell script.(in shell script i am having sqlldr command)(its a host excutable method cocurrent program)
    When i am loading the data, by placing my files(.ctl,.prog,.csv,symbolink file for .prog) in $Custom_top/bin, it is loading exactly. 17000 records inserted.
    But if i am loading the data by placing my files in $custom_top/custom_folders. unable to insert total data. only 43 records inserting.
    Please any one can help me.
    Thanks in advance.
    Rama.

    Srini, Thanks a lot for ur reply,
    Oracle Apps version R12,
    Microsoft windows XP profissional
    Version 2002 service Pack 3
    My Control file Script is:
    load data
    infile '$XADP_TOP/data/CPIU/in/XXOKS_Price_Increase.csv'
    append
    into table XXOKS_CONTRACT_PRICE_INCR_DTLS
    fields terminated BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    (EXCLUSION_FLAG,
    LEGACY_NUMBER,
    CUSTOMER_NUMBER,
    CUSTOMER_NAME,
    REQUEST_ID,
    CONTRACT_NUMBER,
    CONTRACT_START_DATE,
    CONTRACT_END,
    REQUEST_LINE_ID,
    LINE_START_DATE,
    LINE_END_DATE,
    ITEM_NUMBER,
    ITEM_DESCRIPTION,
    UNIT_PRICE,
    QTY,
    NEW_UNIT_PRICE,
    LINE_AMOUNT,
    NEW_LINE_AMOUNT,
    PRICE_INCREASED_DATE,
    PERCENTAGE_INCREASED,
    ORIGINAL_CONTRACT_AMOUNT,
    NEW_CONTRACT_AMOUNT,
    PRICE_INCREASE_AMOUNT)
    My .prog File is: Please fidn that i created symbolink file also for my .prog.
    if [ -z $XADP_TOP ];then
    echo "XADP_TOP environment variable is not set!"
    exit 1
    fi
    cd $XADP_TOP/data/CPIU/in
    DATE=`date +%y%m%d:%H%M`
    i_program_name="$0"
    i_ora_pwd="$1"
    i_user_id="$2"
    i_user_name="$3"
    i_request_id="$4"
    i_ftp_host_name="$5"
    i_ftp_user_name="$6"
    i_ftp_user_password="$7"
    ftp_prog() {
    # FTP Function to reuse the FTP Commands
    if [ $# -ne 6 ];then
    echo "Usage : ftp_prog <Hostname> <User name> <Password> <Remote Directory> <command> <filename>"
    exit 2
    fi
    l_ftp_host_name="$1"
    l_ftp_user_name="$2"
    l_ftp_user_password="$3"
    l_ftpdir="$4"
    l_ftp_command="$5"
    l_ftp_filename="$6"
    ftp -v -n ${l_ftp_host_name} <<EOF
    user ${l_ftp_user_name} ${l_ftp_user_password}
    ascii
    cd ${l_ftpdir}
    ${l_ftp_command} ${l_ftp_filename}
    quit
    EOF
    #exit $?
    # setting the ftp directory
    #ftpdir="/`echo ${TWO_TASK:-$ORACLE_SID}|tr "[A-Z]" "[a-z]"`/CPIU"
    ##ftpdir="/FinTEST/quoting/PS/ar"
    ftpdir="$XADP_TOP/data/CPIU/in"
    # setting the in directory and out directory
    indir="$XADP_TOP/data/CPIU/in"
    outdir="$XADP_TOP/data/CPIU/out"
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} get XXOKS_Price_Increase.csv
    echo $ftpdir
    echo "Converting the data file into unix mode"
    dos2unix XXOKS_Price_Increase.csv XXOKS_Price_Increase.csv
    chmod 777 XXOKS_Price_Increase.csv
    cd $XADP_TOP/bin
    echo "Trying to excute sqlldr and entering into the into control file"
    $ORACLE_HOME/bin/sqlldr userid=$i_ora_pwd control=XXOKS_PRICE_INCR_LOAD log=$XADP_TOP/log/XXOKS_PRICE_INCR_LOAD_${DATE}.log;
    exit_status=$?
    echo "Checking the status and giving permissions to the data file which in in dir"
    if [ $exit_status -eq 0 ]; then
    cd $XADP_TOP/data/CPIU/in
         chmod 777 XXOKS_Price_Increase.csv
    echo "try to move data file into out dir"
    # Moving the file to out directory
    mv XXOKS_Price_Increase.csv ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    #echo "ready to zip file in out dir step6"
    # Zipping the file
    #gzip -f ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    echo "deleting the file which is in dir"
    # Deleting the file from in directory
    /bin/rm -f ${indir}/XXOKS_Price_Increase.csv
    # Deleting from the remote directory
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} delete XXOKS_Price_Increase.csv
    echo "sqlloader finished successfully."
    else
    echo "Error in loader"
    ##echo "Loader error in Price Increase Detials File ${i_file}"
    fi
    exit $exit_status
    And My Log file Comments are
    SQL*Loader: Release 10.1.0.5.0 - Production on Thu Dec 3 01:32:08 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: XXOKS_PRICE_INCR_LOAD.ctl
    Data File: /oesapp/applmgr/GIS11/apps/apps_st/appl/xadp/12.0.0/data/CPIU/in/XXOKS_Price_Increase.csv
    Bad File: XXOKS_Price_Increase.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    EXCLUSION_FLAG FIRST * , O(") CHARACTER
    LEGACY_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NAME NEXT * , O(") CHARACTER
    REQUEST_ID NEXT * , O(") CHARACTER
    CONTRACT_NUMBER NEXT * , O(") CHARACTER
    CONTRACT_START_DATE NEXT * , O(") CHARACTER
    CONTRACT_END NEXT * , O(") CHARACTER
    REQUEST_LINE_ID NEXT * , O(") CHARACTER
    LINE_START_DATE NEXT * , O(") CHARACTER
    LINE_END_DATE NEXT * , O(") CHARACTER
    ITEM_NUMBER NEXT * , O(") CHARACTER
    ITEM_DESCRIPTION NEXT * , O(") CHARACTER
    UNIT_PRICE NEXT * , O(") CHARACTER
    QTY NEXT * , O(") CHARACTER
    NEW_UNIT_PRICE NEXT * , O(") CHARACTER
    LINE_AMOUNT NEXT * , O(") CHARACTER
    NEW_LINE_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASED_DATE NEXT * , O(") CHARACTER
    PERCENTAGE_INCREASED NEXT * , O(") CHARACTER
    ORIGINAL_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    NEW_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASE_AMOUNT NEXT * , O(") CHARACTER
    value used for ROWS parameter changed from 64 to 43
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS:
    43 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 255162 bytes(43 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 43
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Dec 03 01:32:08 2009
    Run ended on Thu Dec 03 01:32:08 2009
    Elapsed time was: 00:00:00.19
    CPU time was: 00:00:00.04
    Plz srini help me.
    Thanks in advance
    Rama..

  • Not able to configure BDC (Business Data connectivity )service in SharePoint 2012 Using Powershell Script

    HI
    Now there is an  issue while iam running powershell script for BDC service.
    Below is the script i am using to configure BDC service.
    Param(           
        [Parameter(Mandatory=$true,ValueFromPipeline=$true)]           
        [string]$ServiceName = $null,
        [Parameter(Mandatory=$true)]           
        [string]$ServiceProxyName = $null,
        [Parameter(Mandatory=$true)]           
        [string]$AppPoolAccount = $null,
        [Parameter(Mandatory=$true)]           
        [string]$AppPoolName = $null,
        [Parameter(Mandatory=$true)]           
        [string]$DatabaseServer = $null,
        [Parameter(Mandatory=$true)]           
        [string]$DatabaseName = $null
    # check to ensure Microsoft.SharePoint.PowerShell is loaded if not using the SharePoint Management Shell
    $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if ($snapin -eq $null) {
        Write-Host "Loading SharePoint Powershell Snapin"
        Add-PSSnapin "Microsoft.SharePoint.Powershell"
    Write-Host "Successfully Sharepoint Powershell snapin Loaded"
    Write-Host "Started executing Powershell script for configuring Business Data Connectivity Service in sharepoint farm ..."
    Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts exists"
    $AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -EA 0
    if($AppPoolAccount -eq $null)
    Write-Host "Please supply the password for the Service Account..."
    $AppPoolCred = Get-Credential $AppPoolAccount
    $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCred -EA 0
    Write-Host -ForegroundColor Yellow "Checking wether the Application Pool exists"
    $AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
    if (!$AppPool)
    Write-Host -ForegroundColor Green "Creating Application Pool"
    $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount -Verbose
    Write-Host -ForegroundColor Yellow "Checking if BDC Service Application exists"
    $ServiceApplication = Get-SPServiceApplication -Name $ServiceName -ErrorAction SilentlyContinue
    if (!$ServiceApplication)
    Write-Host -ForegroundColor Green "Creating BDC Service Application"
    $ServiceApplication = New-SPBusinessDataCatalogServiceApplication –ApplicationPool $AppPool –DatabaseName $DatabaseName –DatabaseServer $DatabaseServer –Name $ServiceName
    Write-Host -ForegroundColor Yellow "Starting the BDC Service"
    #$ServiceInstance = Get-SPServiceInstance | Where-Object { $_.TypeName -like "BDC Service*" }
    #Start-SPServiceInstance $ServiceInstance
    Get-SPServiceInstance | where-object {$_.DisplayName -eq $ServiceName} | Start-SPServiceInstance > $null
    Write-Host -ForegroundColor Green "Done - BDC Service is up and running."
    Error i am getting ->
    Started executing Powershell script for configuring Business Data Connectivity S
    ervice in sharepoint farm ...
    Checking if Application Pool Accounts exists
    Checking wether the Application Pool exists
    Creating Application Pool
    VERBOSE: Leaving BeginProcessing Method of New-SPServiceApplicationPool.
    New-SPServiceApplicationPool : The trust relationship between the primary
    domain and the trusted domain failed.
    At C:\SP2013Service\BDC1.ps1:67 char:12
    + $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account
    $AppPoolAcco ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : InvalidData: (Microsoft.Share...ApplicationPool:
       SPCmdletNewIisWebServiceApplicationPool) [New-SPServiceApplicationPool], S 
      ystemException
        + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewIisWe
       bServiceApplicationPool
    VERBOSE: Leaving ProcessRecord Method of New-SPServiceApplicationPool.
    VERBOSE: Leaving EndProcessing Method of New-SPServiceApplicationPool.
    Checking if BDC Service Application exists
    Creating BDC Service Application
    New-SPBusinessDataCatalogServiceApplication : Cannot bind argument to
    parameter 'ApplicationPool' because it is null.
    At C:\SP2013Service\BDC1.ps1:75 char:84
    + ... pplicationPool $AppPool –DatabaseName $DatabaseName –DatabaseServer
    $DatabaseSer ...
    +                    ~~~~~~~~
        + CategoryInfo          : InvalidData: (:) [New-SPBusinessD...viceApplicat
       ion], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
       icrosoft.SharePoint.BusinessData.SharedService.SPNewBusinessDataCatalogSer 
      viceApplication

    hi guys,
    same script i have modified with parametes,in below script i have hard corded values for parameters,and it is executing without errors.
    Below is script executing without error->
    Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    #Settings
    $ServiceName = "BDC Service"
    $ServiceProxyName = "BDC Proxy"
    $AppPoolAccount = "DOMAIN\USERNAME"
    $AppPoolName = "BDC SP Ser App Pool"
    $DatabaseServer = "SPSQL"
    $DatabaseName = "SP2013 BDC"
    Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts exists"
    $AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -EA 0
    if($AppPoolAccount -eq $null)
    Write-Host "Please supply the password for the Service Account..."
    $AppPoolCred = Get-Credential $AppPoolAccount
    $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCred -EA 0
    Write-Host -ForegroundColor Yellow "Checking wether the Application Pool exists"
    $AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
    if (!$AppPool)
    Write-Host -ForegroundColor Green "Creating Application Pool"
    $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount -Verbose
    Write-Host -ForegroundColor Yellow "Checking if BDC Service Application exists"
    $ServiceApplication = Get-SPServiceApplication -Name $ServiceName -ErrorAction SilentlyContinue
    if (!$ServiceApplication)
    Write-Host -ForegroundColor Green "Creating BDC Service Application"
    $ServiceApplication = New-SPBusinessDataCatalogServiceApplication –ApplicationPool $AppPool –DatabaseName $DatabaseName –DatabaseServer $DatabaseServer –Name $ServiceName
    Write-Host -ForegroundColor Yellow "Starting the BDC Service"
    #$ServiceInstance = Get-SPServiceInstance | Where-Object { $_.TypeName -like "BDC Service*" }
    #Start-SPServiceInstance $ServiceInstance
    Get-SPServiceInstance | where-object {$_.DisplayName -eq $ServiceName} | Start-SPServiceInstance > $null
    Write-Host -ForegroundColor Green "Done - BDC Service is up and running."
    if any body want need more information please can u respond me to
    Email id:[email protected]

Maybe you are looking for

  • IT0009: payment method "cheque" and dynamic actions

    Hello, I need your help on this issue. I have looking for answers on the different posts but i didn't found any similar problems. For a customer, i have to settle, in case of departure (leaving) action , the creation in background of an infotype 0009

  • DVD Player not playing discs

    My DVD player won't play rental dvd's etc .. I get a message saying "Supported Disk Not Available" I have successfully played on 2 dvd's on this machine (it's only 2 weeks old) and each of those times i got a message asking my permission to change th

  • Supplier number required in Purchase order/ requisition

    Hi Gurus, Requirement is to see supplier number in purchase order/ requisition. If we give supplier number automatically system should pickup the supplier name, if we give name system should pick up the supplier number like customer in sales order fo

  • Blocking iMessages in Mavericks OS?

    Can I block iMessages from a specific person with Mavericks operating system?

  • Powershell - site collections, size, owner, last used etc

    Hi All, I know its out there, as I've used something similar, albeit needing fewer info than requested, but I need to be able to provide all site collections in a farm, size, last used, owner and a bit more, which cannot remember, but if someone can