ForEach not initiating Set-Mailbox Command

Script retrieves all User Mailboxes where AuditEnabled equals false then it's supposed to set those users to "true" but for some reason it is skipping my Set-Mailbox command.  I know the variable I'm passing contains data so that's not the
issue and I've tried different syntax but I'm missing something.
#Mail Server Variables
$FromAddress = "[email protected]"
$RelayMailServer = "relay.domain.com"
$ITSupportEmailAddress = "[email protected]"
#Connect to Office 365
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList [email protected],$password
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
$importresults = Import-PSSession $s
$today = Get-Date -Format d
# Define font and font size
# ` or \ is an escape character in powershell
$font = "<font size=`"3`" face=`"Calibri`">"
$UsersList_AuditDisabled = @()
$userslist_auditdisabled += Get-Mailbox -filter {RecipientTypeDetails -eq 'UserMailbox'-and AuditEnabled -eq $false} |select userprincipalname, auditenabled
If ($UsersList_AuditDisabled -eq $null) {$UsersList_AuditDisabled = "No Users to Report"}
else {
$auditfile = "C:\Office365\AuditUsers.csv"
$userslist_auditdisabled | sort userprincipalname | Export-Csv $auditfile -NoTypeInformation}
$userslist_auditdisabled | ForEach
Set-Mailbox $_.userprincipalname -AuditEnabled $true -ErrorAction 'SilentlyContinue'
If ($UsersList_AuditDisabled){
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($auditfile)
$smtp = new-object Net.Mail.SmtpClient($RelayMailServer)
$msg.From = "[email protected]"
$msg.To.Add("[email protected]")
$msg.Subject = "Audit Users Enabled"
$msg.Body = "Attached is the list of users who have Auditing Enabled."
$msg.Attachments.Add($att)
$msg.IsBodyHTML = $true
$smtp.Send($msg)
$att.Dispose()}
Remove-PSSession $s
#Clear all variables
Clear-Variable audit* -scope global

Hi,
First thing - remove -ErrorAction SilentlyContinue from Set-Mailbox and run it again. Any errors?
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)

Similar Messages

  • Sybase:  SET CHAINED command not allowed within multi-statement transaction

    Hello,
    I'm getting the error message "SET CHAINED command not allowed within
    multi-statement transaction" for CMP Entity beans against Sybase.
    The errors appear in my jdbc.log in this order:
    010SM: This database does not support the initial proposed set of
    capabilities, retrying.) SQLState(010SM)
    JZ0EM: End of data.
    JZ0SJ: Metadata accessor information was not found on this database.
    Please install the required tables
    as mentioned in the jConnect documentation.
    010SL: Out-of-date metadata accessor information was found on this
    database. Ask your database administrat
    or to load the latest scripts.) SQLState(010SL)
    SQLState(ZZZZZ) vendor code(226)
    com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed
    within multi-statement transaction.
    I'm using JConnect 5.5, WebLogic 6.1 sp3, Solaris 8, and Sybase 11.
    The weird thing is, the app works on a box running 6.1 sp2 and Win2k
    Prof.
    Any ideas?
    Thanks!
    Dan

    Hi Dan,
    There is a patch for this sybase problem, please contact [email protected] to
    get a temp patch.
    sree
    "Dan Blaner" <[email protected]> wrote in message
    news:[email protected]..
    Hello,
    I'm getting the error message "SET CHAINED command not allowed within
    multi-statement transaction" for CMP Entity beans against Sybase.
    The errors appear in my jdbc.log in this order:
    010SM: This database does not support the initial proposed set of
    capabilities, retrying.) SQLState(010SM)
    JZ0EM: End of data.
    JZ0SJ: Metadata accessor information was not found on this database.
    Please install the required tables
    as mentioned in the jConnect documentation.
    010SL: Out-of-date metadata accessor information was found on this
    database. Ask your database administrat
    or to load the latest scripts.) SQLState(010SL)
    SQLState(ZZZZZ) vendor code(226)
    com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed
    within multi-statement transaction.
    I'm using JConnect 5.5, WebLogic 6.1 sp3, Solaris 8, and Sybase 11.
    The weird thing is, the app works on a box running 6.1 sp2 and Win2k
    Prof.
    Any ideas?
    Thanks!
    Dan

  • TS4000 When I create a reminder the date/time will not stay attached to the reminder. It initially sets then drops off. Any ideas?

    When I create a reminder the date/time will not stay attached to the reminder. It initially sets then drops off. Any ideas?

    Sounds like we have a similar problem.  Four days ago I was playing music through a wireless Bose speaker via bluetooth and everything was fine.  Then I was texting while listening and got 2 texts about the same time as I was typing one and my phone went black.  I pushed the home button and it worked, went into my texts and all were there.  However ever since then the time isn't right, so it can't keep time no matter what I do.  The bluetooth works only at times, the wifi keeps jumping on and off, sometimes my data won't work and the other day I couldn't even turn it off, so had to wait until it died.  The battery life display at that moment wasn't correct either.  Took to Verizon, they couldn't help.  Suggested a factory reset, which I did last night and still the same issues!  One day I couldn't even text my husband on his iPhone.  Just wouldn't work at all.  Did everything suggest and still not good.  Seems like after stalking these pages today a lot of people are having this problem in Dec/Jan and of course also I'm 3 weeks out of my 1 year warranty and so were many others, by days.  Very strange, and all on the 5C.  What did you do?  Is it working now?

  • SET CHAINED command not allowed within multi-statement transaction

    Hi,
    i need to do one transaction and i am setting autocommit(false) and
    once i am don ewith my 2 inserts i am settins it to true.
    i have like 20 thousand rows and when it is working fine for some inserts but after that it is throwing
    "SET CHAINED command not allowed within multi-statement transaction".
    can anyone please help me.

    You can find some information here:
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rtrb_dsaccess.html
    it's first problem for sybase DB

  • Correlation set "Correlation_set" is not initialized. It cannot be used in a receiving activity. Fault is thrown.

    Hello,
    My bpel goes something like this:
    Main processing
    Receive activity (associated correlation set with initiate set to Yes)
    on Event - activity 1
    Receive activity is main. If I keep activity1 correlation set - initiates as Yes. then process will work but onEvent - activity1 will create new instance and will not update existing instance.
    To update the existing instance, I nned to make its instantiate value as "No".
    After changing instantiate value to "No", When the BPEL process is started, with the first message (main receive activity), I get the following error message:
    Correlation set "Correlation_set" is not initialized. It cannot be used in a receiving activity. Fault is thrown.
    Is there something I am missing?
    Thanks,
    Amit Pamecha.

    Hi Amit,
    Please refer the following section in SOA Developer Guide.
    Using Correlation Sets and Message Aggregation - 11g Release 1 (11.1.1.7)
    Also Refer the following sample for use of correlation sets.
    bpel-305-InboundCorrelationShows how to perform message correlation within BPEL
    http://java.net/projects/oraclesoasuite11g/downloads/download/BPEL/bpel-305-InboundCorrelation_1.2.zip

  • HT2646 Apple TV will not let me select my language during initial set up

    Apple TV will not allow me to select my language during the initial set up.  It simply stays on the initial first page saying I can select my language.  Unfortunately, every time I hit "select" on the remote, it will not recognize that I am trying to select my language (English).  Therefore I cannot get to any of remaining set up.

    Welcome to the Apple Community.
    Check you are using the correct location in the Apple TV store settings.
    Try changing a few details and changing them back before updating when you verify in iTunes, also check that your details are correct (ie that you have filled the state field out properly and so on)
    Rentals don't just show up on the Apple TV when you have rented then on your mac/PC,you need to transfer them.
    See This

  • HT204053 When I initially set up my iPad, I decided not to use I Cloud. Now I want to use it and can't find it in the settings. How do I get it back?

    When I initially set up my IPad, I decided not to use ICloud.  Now I want it and can't find it in settings. How do I get it back?

    Welcome to the Apple Community.
    Your profile says you are using iOS 4.3.3, if this is correct you will need to update your iPad before you can use iCloud.

  • PowerShell cmdlet Set-Mailbox parameters not working

    Great suggestion, will do. Thanks Matthew.

    Essentially I'm just trying to set Shared Mailbox default behaviour for when a user sends an email from that mailbox the sent email is placedin the Shared Mailbox sent folder instead of the users sent folder which is what it does now. This is supposed to be possible with Powershell according to MS. We're using Office 365 Enterprise for this. The error is the following:PS C:\ Get-Mailbox TestSharedMailbox | select *message*MessageCopyForSentAsEnabled : FalseMessageCopyForSendOnBehalfEnabled : FalseMessageTrackingReadStatusEnabled : TrueDowngradeHighPriorityMessagesEnabled : FalsePS C:\ Set-Mailbox TestSharedMailbox -MessageCopyForSentAsEnabled $TrueA parameter cannot be found that matches parameter name 'MessageCopyForSentAsEnabled'. + CategoryInfo : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException + FullyQualifiedErrorId :...
    This topic first appeared in the Spiceworks Community

  • Autodetection not properly setting up wacom tablet

    I have a tablet PC, and recently upgraded to xserver 1.6.  X would freeze on startup roughly 50% of the time until (based on this thread) I removed xorg.conf (except for DontZap).  Now X doesn't freeze on start, but the tablet is only being partially detected.
    I can use it to move the cursor fine.  The eraser does not work.
    'xsetwacom list dev' does not detect any devices.  This means I can't get or set any properties, recalibrate, rotate, or any other goodies.
    output of 'xinput list' seems to indicate that it's being set up as some kind of generic plug-and-play device.
    "Virtual core pointer" id=0 [XPointer]
    Num_buttons is 32
    Num_axes is 2
    Mode is Relative
    Motion_buffer is 256
    Axis 0 :
    Min_value is -1
    Max_value is -1
    Resolution is 0
    Axis 1 :
    Min_value is -1
    Max_value is -1
    Resolution is 0
    "Virtual core keyboard" id=1 [XKeyboard]
    Num_keys is 248
    Min_keycode is 8
    Max_keycode is 255
    "TPPS/2 IBM TrackPoint" id=2 [XExtensionPointer]
    Num_buttons is 32
    Num_axes is 2
    Mode is Relative
    Motion_buffer is 256
    Axis 0 :
    Min_value is -1
    Max_value is -1
    Resolution is 1
    Axis 1 :
    Min_value is -1
    Max_value is -1
    Resolution is 1
    "ThinkPad Extra Buttons" id=3 [XExtensionKeyboard]
    Num_keys is 248
    Min_keycode is 8
    Max_keycode is 255
    "PnP Device (WACf008)" id=4 [XExtensionKeyboard]
    Num_keys is 248
    Min_keycode is 8
    Max_keycode is 255
    Num_buttons is 32
    Num_axes is 6
    Mode is Absolute
    Motion_buffer is 256
    Axis 0 :
    Min_value is 0
    Max_value is 24576
    Resolution is 2540
    Axis 1 :
    Min_value is 0
    Max_value is 18432
    Resolution is 2540
    Axis 2 :
    Min_value is 0
    Max_value is 255
    Resolution is 1
    Axis 3 :
    Min_value is -64
    Max_value is 63
    Resolution is 1
    Axis 4 :
    Min_value is -64
    Max_value is 63
    Resolution is 1
    Axis 5 :
    Min_value is 0
    Max_value is 1023
    Resolution is 1
    "AT Translated Set 2 keyboard" id=5 [XExtensionKeyboard]
    Num_keys is 248
    Min_keycode is 8
    Max_keycode is 255
    "Macintosh mouse button emulation" id=6 [XExtensionPointer]
    Num_buttons is 32
    Num_axes is 2
    Mode is Relative
    Motion_buffer is 256
    Axis 0 :
    Min_value is -1
    Max_value is -1
    Resolution is 1
    Axis 1 :
    Min_value is -1
    Max_value is -1
    Resolution is 1
    "Video Bus" id=7 [XExtensionKeyboard]
    Num_keys is 248
    Min_keycode is 8
    Max_keycode is 255
    Here's Xorg.0.log.  This used to have separate sections for Stylus/Eraser/Cursor all being set up.
    X.Org X Server 1.6.1
    Release Date: 2009-4-14
    X Protocol Version 11, Revision 0
    Build Operating System: Linux 2.6.29-ARCH i686
    Current Operating System: Linux malachite 2.6.29-ARCH #1 SMP PREEMPT Fri Apr 17 12:46:01 UTC 2009 i686
    Build Date: 15 April 2009 11:09:10AM
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
    Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: "/var/log/Xorg.0.log", Time: Thu Apr 23 16:07:36 2009
    (==) Using config file: "/etc/X11/xorg.conf"
    (==) No Layout section. Using the first Screen section.
    (==) No screen section available. Using defaults.
    (**) |-->Screen "Default Screen Section" (0)
    (**) | |-->Monitor "<default monitor>"
    (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
    (**) Option "DontZap" "no"
    (==) Automatically adding devices
    (==) Automatically enabling devices
    (==) FontPath set to:
    /usr/share/fonts/misc,
    /usr/share/fonts/100dpi:unscaled,
    /usr/share/fonts/75dpi:unscaled,
    /usr/share/fonts/TTF,
    /usr/share/fonts/Type1,
    built-ins
    (==) ModulePath set to "/usr/lib/xorg/modules"
    (II) Cannot locate a core pointer device.
    (II) Cannot locate a core keyboard device.
    (II) The server relies on HAL to provide the list of input devices.
    If no devices become available, reconfigure HAL or disable AllowEmptyInput.
    (II) Loader magic: 0x1a40
    (II) Module ABI versions:
    X.Org ANSI C Emulation: 0.4
    X.Org Video Driver: 5.0
    X.Org XInput driver : 4.0
    X.Org Server Extension : 2.0
    (II) Loader running on linux
    (--) using VT number 7
    (--) PCI:*(0@0:2:0) Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller rev 12, Mem @ 0xf8100000/1048576, 0xe0000000/268435456, I/O @ 0x00001800/8
    (--) PCI: (0@0:2:1) Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller rev 12, Mem @ 0xf8200000/1048576
    (II) Open ACPI successful (/var/run/acpid.socket)
    (II) System resource ranges:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [5] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    (II) LoadModule: "extmod"
    (II) Loading /usr/lib/xorg/modules/extensions//libextmod.so
    (II) Module extmod: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension MIT-SCREEN-SAVER
    (II) Loading extension XFree86-VidModeExtension
    (II) Loading extension XFree86-DGA
    (II) Loading extension DPMS
    (II) Loading extension XVideo
    (II) Loading extension XVideo-MotionCompensation
    (II) Loading extension X-Resource
    (II) LoadModule: "dbe"
    (II) Loading /usr/lib/xorg/modules/extensions//libdbe.so
    (II) Module dbe: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension DOUBLE-BUFFER
    (II) LoadModule: "glx"
    (II) Loading /usr/lib/xorg/modules/extensions//libglx.so
    (II) Module glx: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    ABI class: X.Org Server Extension, version 2.0
    (==) AIGLX enabled
    (II) Loading extension GLX
    (II) LoadModule: "record"
    (II) Loading /usr/lib/xorg/modules/extensions//librecord.so
    (II) Module record: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.13.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension RECORD
    (II) LoadModule: "dri"
    (II) Loading /usr/lib/xorg/modules/extensions//libdri.so
    (II) Module dri: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension XFree86-DRI
    (II) LoadModule: "dri2"
    (II) Loading /usr/lib/xorg/modules/extensions//libdri2.so
    (II) Module dri2: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension DRI2
    (==) Matched intel for the autoconfigured driver
    (==) Assigned the driver to the xf86ConfigLayout
    (II) LoadModule: "intel"
    (II) Loading /usr/lib/xorg/modules/drivers//intel_drv.so
    (II) Module intel: vendor="X.Org Foundation"
    compiled for 1.6.0, module version = 2.6.3
    Module class: X.Org Video Driver
    ABI class: X.Org Video Driver, version 5.0
    (II) intel: Driver for Intel Integrated Graphics Chipsets: i810,
    i810-dc100, i810e, i815, i830M, 845G, 852GM/855GM, 865G, 915G,
    E7221 (i915), 915GM, 945G, 945GM, 945GME, 965G, G35, 965Q, 946GZ,
    965GM, 965GME/GLE, G33, Q35, Q33,
    Mobile Intel® GM45 Express Chipset,
    Intel Integrated Graphics Device, G45/G43, Q45/Q43, G41
    (II) Primary Device is: PCI 00@00:02:0
    (II) resource ranges after xf86ClaimFixedResources() call:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [5] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    (II) resource ranges after probing:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] 0 0 0x000a0000 - 0x000affff (0x10000) MS[b]
    [5] 0 0 0x000b0000 - 0x000b7fff (0x8000) MS[b]
    [6] 0 0 0x000b8000 - 0x000bffff (0x8000) MS[b]
    [7] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [8] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    [9] 0 0 0x000003b0 - 0x000003bb (0xc) IS[b]
    [10] 0 0 0x000003c0 - 0x000003df (0x20) IS[b]
    (II) Loading sub module "vgahw"
    (II) LoadModule: "vgahw"
    (II) Loading /usr/lib/xorg/modules//libvgahw.so
    (II) Module vgahw: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 0.1.0
    ABI class: X.Org Video Driver, version 5.0
    (II) intel(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
    (==) intel(0): Depth 24, (--) framebuffer bpp 32
    (==) intel(0): RGB weight 888
    (==) intel(0): Default visual is TrueColor
    (II) intel(0): Integrated Graphics Chipset: Intel(R) 965GM
    (--) intel(0): Chipset: "965GM"
    (--) intel(0): Linear framebuffer at 0xE0000000
    (--) intel(0): IO registers at addr 0xF8100000
    (WW) intel(0): libpciaccess reported 0 rom size, guessing 64kB
    (==) intel(0): Using EXA for acceleration
    (II) intel(0): 2 display pipes available.
    (II) Loading sub module "ddc"
    (II) LoadModule: "ddc"
    (II) Module "ddc" already built-in
    (II) Loading sub module "i2c"
    (II) LoadModule: "i2c"
    (II) Module "i2c" already built-in
    (II) intel(0): Output VGA has no monitor section
    (II) intel(0): Output LVDS has no monitor section
    (II) intel(0): I2C bus "LVDSDDC_C" initialized.
    (II) intel(0): Attempting to determine panel fixed mode.
    (II) intel(0): I2C device "LVDSDDC_C:E-EDID segment register" registered at address 0x60.
    (II) intel(0): I2C device "LVDSDDC_C:ddc2" registered at address 0xA0.
    (II) intel(0): EDID vendor "LEN", prod id 16386
    (II) intel(0): found backlight control method /sys/class/backlight/acpi_video0
    (II) intel(0): I2C bus "SDVOCTRL_E for SDVOC" initialized.
    (II) intel(0): I2C device "SDVOCTRL_E for SDVOC:SDVO Controller C" registered at address 0x72.
    (II) intel(0): No SDVO device found on SDVOC
    (II) intel(0): I2C device "SDVOCTRL_E for SDVOC:SDVO Controller C" removed.
    (II) intel(0): I2C bus "SDVOCTRL_E for SDVOC" removed.
    (II) intel(0): Resizable framebuffer: not available (1 3)
    (II) intel(0): EDID vendor "LEN", prod id 16386
    (II) intel(0): Output VGA disconnected
    (II) intel(0): Output LVDS connected
    (II) intel(0): Using exact sizes for initial modes
    (II) intel(0): Output LVDS using initial mode 1024x768
    (II) intel(0): detected 512 kB GTT.
    (II) intel(0): detected 7676 kB stolen memory.
    (==) intel(0): video overlay key set to 0x101fe
    (==) intel(0): Will not try to enable page flipping
    (==) intel(0): Triple buffering disabled
    (==) intel(0): Using gamma correction (1.0, 1.0, 1.0)
    (==) intel(0): DPI set to (96, 96)
    (II) Loading sub module "fb"
    (II) LoadModule: "fb"
    (II) Loading /usr/lib/xorg/modules//libfb.so
    (II) Module fb: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    ABI class: X.Org ANSI C Emulation, version 0.4
    (II) Loading sub module "exa"
    (II) LoadModule: "exa"
    (II) Loading /usr/lib/xorg/modules//libexa.so
    (II) Module exa: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 2.4.0
    ABI class: X.Org Video Driver, version 5.0
    (II) Loading sub module "ramdac"
    (II) LoadModule: "ramdac"
    (II) Module "ramdac" already built-in
    (II) intel(0): Comparing regs from server start up to After PreInit
    (WW) intel(0): Register 0x61200 (PP_STATUS) changed from 0xc0000008 to 0xd000000a
    (WW) intel(0): PP_STATUS before: on, ready, sequencing idle
    (WW) intel(0): PP_STATUS after: on, ready, sequencing on
    (WW) intel(0): Register 0x71024 (PIPEBSTAT) changed from 0x00000206 to 0x80000246
    (WW) intel(0): PIPEBSTAT before: status: VSYNC_INT_STATUS SVBLANK_INT_STATUS VBLANK_INT_STATUS
    (WW) intel(0): PIPEBSTAT after: status: FIFO_UNDERRUN VSYNC_INT_STATUS LBLC_EVENT_STATUS SVBLANK_INT_STATUS VBLANK_INT_STATUS
    (==) Depth 24 pixmap format is 32 bpp
    (II) do I need RAC? No, I don't.
    (II) resource ranges after preInit:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] 0 0 0x000a0000 - 0x000affff (0x10000) MS[b](OprD)
    [5] 0 0 0x000b0000 - 0x000b7fff (0x8000) MS[b](OprD)
    [6] 0 0 0x000b8000 - 0x000bffff (0x8000) MS[b](OprD)
    [7] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [8] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    [9] 0 0 0x000003b0 - 0x000003bb (0xc) IS[b](OprU)
    [10] 0 0 0x000003c0 - 0x000003df (0x20) IS[b](OprU)
    (II) intel(0): Kernel reported 481024 total, 1 used
    (II) intel(0): I830CheckAvailableMemory: 1924092 kB available
    (WW) intel(0): DRI2 requires UXA
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:00:02.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: drmOpenMinor returns 11
    drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
    (II) [drm] DRM interface version 1.3
    (II) [drm] DRM open master succeeded.
    (II) intel(0): [drm] Using the DRM lock SAREA also for drawables.
    (II) intel(0): [drm] framebuffer mapped by ddx driver
    (II) intel(0): [drm] added 1 reserved context for kernel
    (II) intel(0): X context handle = 0x1
    (II) intel(0): [drm] installed DRM signal handler
    (**) intel(0): Framebuffer compression disabled
    (**) intel(0): Tiling enabled
    (==) intel(0): VideoRam: 262144 KB
    (II) intel(0): Attempting memory allocation with tiled buffers.
    (II) intel(0): Tiled allocation successful.
    (II) intel(0): [drm] Registers = 0xf8100000
    (II) intel(0): [drm] Initialized kernel agp heap manager, 33554432
    (II) intel(0): [dri] visual configs initialized
    (II) intel(0): Page Flipping disabled
    (II) intel(0): vgaHWGetIOBase: hwp->IOBase is 0x03d0, hwp->PIOOffset is 0x0000
    (II) EXA(0): Offscreen pixmap area of 12582912 bytes
    (II) EXA(0): Driver registered support for the following operations:
    (II) Solid
    (II) Copy
    (II) Composite (RENDER acceleration)
    (==) intel(0): Backing store disabled
    (==) intel(0): Silken mouse enabled
    (II) intel(0): Initializing HW Cursor
    (II) intel(0): [DRI] installation complete
    (II) intel(0): xf86BindGARTMemory: bind key 0 at 0x0d400000 (pgoffset 54272)
    (II) intel(0): xf86BindGARTMemory: bind key 1 at 0x0e000000 (pgoffset 57344)
    (II) intel(0): Fixed memory allocation layout:
    (II) intel(0): 0x00000000-0x00000fff: power context (4 kB)
    (II) intel(0): 0x0077f000: end of stolen memory
    (II) intel(0): 0x0077f000-0x0d3fffff: DRI memory manager (209412 kB)
    (II) intel(0): 0x0d400000-0x0dffffff: exa offscreen (12288 kB)
    (II) intel(0): 0x0e000000-0x0fffffff: classic textures (32768 kB)
    (II) intel(0): 0x10000000: end of aperture
    (II) intel(0): BO memory allocation layout:
    (II) intel(0): 0x0077f000: start of memory manager
    (II) intel(0): 0x0079f000-0x00b9efff: depth buffer (4096 kB) Y tiled
    (II) intel(0): 0x00b9f000-0x00f9efff: back buffer (4096 kB) X tiled
    (II) intel(0): 0x00f9f000-0x0139efff: front buffer (4096 kB) X tiled
    (II) intel(0): 0x0139f000-0x0139ffff: overlay registers (4 kB)
    (II) intel(0): 0x013a0000-0x013a9fff: HW cursors (40 kB)
    (II) intel(0): 0x0d400000: end of memory manager
    (WW) intel(0): ESR is 0x00000001
    (WW) intel(0): Existing errors found in hardware state.
    (II) intel(0): using SSC reference clock of 100 MHz
    (II) intel(0): Selecting standard 18 bit TMDS pixel format.
    (II) intel(0): Output configuration:
    (II) intel(0): Pipe A is off
    (II) intel(0): Display plane A is now disabled and connected to pipe A.
    (II) intel(0): Pipe B is on
    (II) intel(0): Display plane B is now enabled and connected to pipe B.
    (II) intel(0): Output VGA is connected to pipe none
    (II) intel(0): Output LVDS is connected to pipe B
    (II) intel(0): [drm] mapped front buffer at 0xe0f9f000, handle = 0xe0f9f000
    (II) intel(0): [drm] mapped back buffer at 0xe0b9f000, handle = 0xe0b9f000
    (II) intel(0): [drm] mapped depth buffer at 0xe079f000, handle = 0xe079f000
    (II) intel(0): [drm] mapped classic textures at 0xee000000, handle = 0xee000000
    (II) intel(0): RandR 1.2 enabled, ignore the following RandR disabled message.
    (II) intel(0): DPMS enabled
    (==) intel(0): Intel XvMC decoder disabled
    (II) intel(0): Set up textured video
    (II) intel(0): Set up overlay video
    (II) intel(0): direct rendering: XF86DRI Enabled
    (--) RandR disabled
    (II) Initializing built-in extension Generic Event Extension
    (II) Initializing built-in extension SHAPE
    (II) Initializing built-in extension MIT-SHM
    (II) Initializing built-in extension XInputExtension
    (II) Initializing built-in extension XTEST
    (II) Initializing built-in extension BIG-REQUESTS
    (II) Initializing built-in extension SYNC
    (II) Initializing built-in extension XKEYBOARD
    (II) Initializing built-in extension XC-MISC
    (II) Initializing built-in extension SECURITY
    (II) Initializing built-in extension XINERAMA
    (II) Initializing built-in extension XFIXES
    (II) Initializing built-in extension RENDER
    (II) Initializing built-in extension RANDR
    (II) Initializing built-in extension COMPOSITE
    (II) Initializing built-in extension DAMAGE
    (II) AIGLX: Screen 0 is not DRI2 capable
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 12, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:00:02.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 12, (OK)
    drmOpenByBusid: drmOpenMinor returns 12
    drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
    (II) AIGLX: enabled GLX_SGI_make_current_read
    (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
    (II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
    (II) AIGLX: enabled GLX_texture_from_pixmap with driver support
    (II) AIGLX: Loaded and initialized /usr/lib/xorg/modules/dri/i965_dri.so
    (II) GLX: Initialized DRI GL provider for screen 0
    (II) intel(0): Setting screen physical size to 245 x 184
    (II) config/hal: Adding input device TPPS/2 IBM TrackPoint
    (II) LoadModule: "evdev"
    (II) Loading /usr/lib/xorg/modules/input//evdev_drv.so
    (II) Module evdev: vendor="X.Org Foundation"
    compiled for 1.6.0, module version = 2.2.1
    Module class: X.Org XInput Driver
    ABI class: X.Org XInput driver, version 4.0
    (**) TPPS/2 IBM TrackPoint: always reports core events
    (**) TPPS/2 IBM TrackPoint: Device: "/dev/input/event8"
    (II) TPPS/2 IBM TrackPoint: Found 3 mouse buttons
    (II) TPPS/2 IBM TrackPoint: Found x and y relative axes
    (II) TPPS/2 IBM TrackPoint: Configuring as mouse
    (**) Option "Emulate3Buttons" "true"
    (II) TPPS/2 IBM TrackPoint: Forcing middle mouse button emulation on.
    (**) Option "EmulateWheel" "true"
    (**) Option "EmulateWheelButton" "2"
    (**) TPPS/2 IBM TrackPoint: YAxisMapping: buttons 4 and 5
    (**) TPPS/2 IBM TrackPoint: EmulateWheelButton: 2, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
    (II) XINPUT: Adding extended input device "TPPS/2 IBM TrackPoint" (type: MOUSE)
    (**) TPPS/2 IBM TrackPoint: (accel) keeping acceleration scheme 1
    (**) TPPS/2 IBM TrackPoint: (accel) filter chain progression: 2.00
    (**) TPPS/2 IBM TrackPoint: (accel) filter stage 0: 20.00 ms
    (**) TPPS/2 IBM TrackPoint: (accel) set acceleration profile 0
    (II) config/hal: Adding input device ThinkPad Extra Buttons
    (**) ThinkPad Extra Buttons: always reports core events
    (**) ThinkPad Extra Buttons: Device: "/dev/input/event7"
    (II) ThinkPad Extra Buttons: Found keys
    (II) ThinkPad Extra Buttons: Configuring as keyboard
    (II) XINPUT: Adding extended input device "ThinkPad Extra Buttons" (type: KEYBOARD)
    (**) Option "xkb_rules" "evdev"
    (**) Option "xkb_model" "evdev"
    (**) Option "xkb_layout" "us"
    (II) config/hal: Adding input device PnP Device (WACf008)
    (II) LoadModule: "wacom"
    (II) Loading /usr/lib/xorg/modules/input//wacom_drv.so
    (II) Module wacom: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 1.0.0
    Module class: X.Org XInput Driver
    ABI class: X.Org XInput driver, version 4.0
    (II) Wacom driver level: 47-0.8.3-2 $
    (**) PnP Device (WACf008): always reports core events
    (**) PnP Device (WACf008) device is /dev/tts/0
    (**) PnP Device (WACf008) is in absolute mode
    (**) PnP Device (WACf008): forcing TabletPC ISD V4 protocol
    (**) WACOM: suppress value is 2
    (**) /dev/tts/0: Tablet PC buttons are on
    (**) Option "BaudRate" "9600"
    (**) PnP Device (WACf008): serial speed 9600
    (II) XINPUT: Adding extended input device "PnP Device (WACf008)" (type: Wacom Stylus)
    (**) Option "Device" "/dev/tts/0"
    (**) Option "StopBits" "1"
    (**) Option "DataBits" "8"
    (**) Option "Parity" "None"
    (**) Option "Vmin" "1"
    (**) Option "Vtime" "10"
    (**) Option "FlowControl" "Xoff"
    usbDetect: can not ioctl version
    Wacom ISDV4 control data (0) error in % query
    (==) Wacom using pressure threshold of 15 for button 1
    (==) Wacom General ISDV4 tablet speed=9600 (38400) maxX=24576 maxY=18432 maxZ=255 resX=2540 resY=2540 tilt=disabled
    (==) Wacom device "PnP Device (WACf008)" top X=0 top Y=0 bottom X=24576 bottom Y=18432 resol X=2540 resol Y=2540
    (II) config/hal: Adding input device AT Translated Set 2 keyboard
    (**) AT Translated Set 2 keyboard: always reports core events
    (**) AT Translated Set 2 keyboard: Device: "/dev/input/event1"
    (II) AT Translated Set 2 keyboard: Found keys
    (II) AT Translated Set 2 keyboard: Configuring as keyboard
    (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD)
    (**) Option "xkb_rules" "evdev"
    (**) Option "xkb_model" "evdev"
    (**) Option "xkb_layout" "us"
    (II) config/hal: Adding input device Macintosh mouse button emulation
    (**) Macintosh mouse button emulation: always reports core events
    (**) Macintosh mouse button emulation: Device: "/dev/input/event0"
    (II) Macintosh mouse button emulation: Found 3 mouse buttons
    (II) Macintosh mouse button emulation: Found x and y relative axes
    (II) Macintosh mouse button emulation: Configuring as mouse
    (**) Macintosh mouse button emulation: YAxisMapping: buttons 4 and 5
    (**) Macintosh mouse button emulation: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
    (II) XINPUT: Adding extended input device "Macintosh mouse button emulation" (type: MOUSE)
    (**) Macintosh mouse button emulation: (accel) keeping acceleration scheme 1
    (**) Macintosh mouse button emulation: (accel) filter chain progression: 2.00
    (**) Macintosh mouse button emulation: (accel) filter stage 0: 20.00 ms
    (**) Macintosh mouse button emulation: (accel) set acceleration profile 0
    (II) config/hal: Adding input device Video Bus
    (**) Video Bus: always reports core events
    (**) Video Bus: Device: "/dev/input/event5"
    (II) Video Bus: Found keys
    (II) Video Bus: Configuring as keyboard
    (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD)
    (**) Option "xkb_rules" "evdev"
    (**) Option "xkb_model" "evdev"
    (**) Option "xkb_layout" "us"
    Last but not least, the output of lshal relevant to the wacom device, which seems to indicate that it knows something is there.  there are no event devices associated like there are with kbd/mouse/etc.
    udi = '/org/freedesktop/Hal/devices/pnp_WACf008'
    info.linux.driver = 'serial' (string)
    info.parent = '/org/freedesktop/Hal/devices/computer' (string)
    info.product = 'PnP Device (WACf008)' (string)
    info.subsystem = 'pnp' (string)
    info.udi = '/org/freedesktop/Hal/devices/pnp_WACf008' (string)
    linux.hotplug_type = 2 (0x2) (int)
    linux.subsystem = 'pnp' (string)
    linux.sysfs_path = '/sys/devices/pnp0/00:0a' (string)
    pnp.id = 'WACf008' (string)
    pnp.serial.irq = 5 (0x5) (int)
    pnp.serial.port = '0x200' (string)
    udi = '/org/freedesktop/Hal/devices/pnp_WACf008_serial_platform_0'
    access_control.file = '/dev/tts/0' (string)
    access_control.type = 'modem' (string)
    info.callouts.add = {'hal-acl-tool --add-device', 'hal-setup-wacom', 'hal-setup-wacom'} (string list)
    info.callouts.remove = {'hal-acl-tool --remove-device'} (string list)
    info.capabilities = {'serial', 'access_control', 'input', 'input'} (string list)
    info.category = 'serial' (string)
    info.parent = '/org/freedesktop/Hal/devices/pnp_WACf008' (string)
    info.product = 'PnP Device (WACf008)' (string)
    info.subsystem = 'tty' (string)
    info.udi = '/org/freedesktop/Hal/devices/pnp_WACf008_serial_platform_0' (string)
    input.device = '/dev/tts/0' (string)
    input.x11_driver = 'wacom' (string)
    input.x11_options.ForceDevice = 'ISDV4' (string)
    input.x11_options.Type = 'stylus' (string)
    linux.device_file = '/dev/tts/0' (string)
    linux.hotplug_type = 2 (0x2) (int)
    linux.subsystem = 'tty' (string)
    linux.sysfs_path = '/sys/devices/pnp0/00:0a/tty/ttyS0' (string)
    serial.device = '/dev/tts/0' (string)
    serial.originating_device = '/org/freedesktop/Hal/devices/pnp_WACf008' (string)
    serial.port = 0 (0x0) (int)
    serial.type = 'platform' (string)
    wacom.types = {'eraser', 'touch', 'eraser', 'touch'} (string list)
    grateful for any suggestions anyone has beyond this point.

    well, the answer is easy but I am annoyed to have wasted so much time figuring it out.
    it is this: the linuxwacom-dev package seems to have installed hal-setup-wacom to /usr/libexec/, and as a result hal cannot find it.
    just doing:
    cp /usr/libexec/hal-setup-wacom /usr/lib/hal
    gives me a working eraser (after restarting hal and then restarting X).
    EDIT: also, if "xinput --list --short" does not list devices with the standard names stylus/eraser, then to get xsetwacom running properly put this in a script and run it from /etc/rc.local: (script stolen from another forum)
    #! /bin/sh
    for udi in `hal-find-by-property --key input.x11_driver --string wacom`
    do
    type=`hal-get-property --udi $udi --key input.x11_options.Type`
    hal-set-property --udi $udi --key info.product --string $type
    done
    I tried to write this logic into the fdi policy, but somehow couldn't get it to work.
    Last edited by tlawson (2009-04-30 20:08:35)

  • "Cipher not initialized" when trying to invoke CRM On Demand web service

    Hi,
    I'm try to invoke CRM On Demand web service for which there is a pre-req to get a session ID by making an https request. I've the below java embedded code which does that. It works fine if I run the below code in my desktop as a java program, but when I deploy it on SOA 11g I get "Caused by: java.lang.IllegalStateException: Cipher not initialized" error (find below the stack trace). Please let me know what's going wrong here?
    String sessionString = "FAIL";
    String wsLocation =
    "https://secure-********.crmondemand.com/Services/Integration";
    String headerName;
    try {
    // create an HTTPS connection to the OnDemand webservices
    java.net.URL wsURL =
    new java.net.URL(wsLocation + "?command=login");
    java.net.HttpURLConnection wsConnection =
    (java.net.HttpURLConnection)wsURL.openConnection();
    // disable caching
    wsConnection.setUseCaches(false);
    // set some http headers to indicate the username and password we are using to logon
    wsConnection.setRequestProperty("UserName",
    wsConnection.setRequestProperty("Password", "***********");
    wsConnection.setRequestMethod("GET");
    // see if we got a successful response
    if (wsConnection.getResponseCode() ==
    java.net.HttpURLConnection.HTTP_OK) {
    // get the session id from the cookie setting
    for (int i = 0; ; i++) {
    headerName = wsConnection.getHeaderFieldKey(i);
    if (headerName != null &&
    headerName.equals("Set-Cookie")) {
    // found the Set-Cookie header (code assumes only one cookie is being set)
    sessionString = wsConnection.getHeaderField(i);
    if (sessionString != null ||
    sessionString.startsWith("JSESSIONID")) {
    break;
    String formattedID =
    sessionString.substring(sessionString.indexOf("=") + 1,
    sessionString.indexOf(";"));
    setVariableData("SessionID", formattedID);
    //System.out.println("Session ID: " + sessionString);
    } catch (Exception e) {
    e.printStackTrace();
    setVariableData("SessionID", e.getMessage());
    System.out.println("Logon Exception generated :: " + e);
    throw new RuntimeException(e);
    Caused by: java.lang.IllegalStateException: Cipher not initialized
    at javax.crypto.Cipher.c(DashoA13*..)
    at javax.crypto.Cipher.update(DashoA13*..)
    at com.certicom.tls.provider.Cipher.update(Unknown Source)
    at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
    at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
    at com.certicom.tls.record.MessageFragmentor.write(Unknown Source)
    at com.certicom.tls.record.WriteHandler.write(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown Source)
    at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source)
    at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source)
    at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source)
    at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source)
    at com.certicom.tls.record.WriteHandler.write(Unknown Source)
    at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
    at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:158)
    at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:363)
    at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
    at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:952)
    at orabpel.productquerybpelprocess.ExecLetBxExe0.execute(ExecLetBxExe0.java:93)
    Thanks!

    Same question...did you ever got this resolved...for me, even the simple java program, when run on JDev 11g is ALSO not working. I am getting this.
    Using JDev 10g on the same machine (or for that matter SOA 10g) works perfectly.
    Have posted this thread too - Getting SSLHandshakeException when trying to login to OCOD using Jdev 11g
    Thanks,
    Amit

  • ORA-24324: service handle not initialized

    I ran the catexp.sql and catalog.sql twice
    The first time on the user system in the sql
    and the second time on cmd i ran sqlplus /nolog
    connect system/xxx as sysdba.
    I use oracle on windows XP
    i have a problem with the export full like this
    . exporting object type definitions for user SYSTEM
    About to export SYSTEM's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00000: Export terminated unsuccessfully
    Could you help me?

    the status listener.ora is started
    on the cmd
    set TERM=ansi
    set ORACLE_SID=banobras
    I tried do it by twice forms by line command and exp_car1.par
    where (exp_car1.par)
    userid=cartera/cartera
    file=exp_cartab_test.dmp
    log=log_cartab_test.log
    full=y
    C:\oracle\ora92>exp parfile=exp_car1.par
    Export: Release 9.2.0.1.0 - Production on MiÚ Dec 21 12:03:49 2005
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P15 character set (possible charset conversion)
    About to export the entire database ...
    . exporting tablespace definitions
    . exporting profiles
    . exporting user definitions
    . exporting roles
    . exporting resource costs
    . exporting rollback segment definitions
    . exporting database links
    . exporting sequence numbers
    . exporting directory aliases
    . exporting context namespaces
    . exporting foreign function library names
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions
    The process remains hung and does not advance, already it does not order mistakes
    Thanks in advance!

  • How to block domains not for all mailboxes in our organization?

    Hello everybody! Need some advice - I have a script to block some domains ("black domains list") - I am using this command: Set-SenderFilterConfig -BlockedDomains:$list But now I need to block these domains not for all mailboxes in our organization,
    for example: somebody is sending a message from "black" domain company.com and there is a mailbox [email protected] - so only this user should receive message from "black" domain. Any others should receive nothing even their addresses
    are in copy. Is it possible? Thanks.

    Hi,
    When we use Set-SenderFilterConfig –BlockedDomains to block domain, exchange will block any messages from that domain without any exception.
    The only thing I can think of is transport rule, so please try to create this transport rule to have a test:
    If this transport rule doesn't work, then there is no way to block domain not for all mailboxes in organization based on my knowledge.
    Best Regards.

  • How to add email address based on email alias? Get-Mailbox | Set-Mailbox -EmailAddresses @{add= $_.Alias + "@TEST"}

    I can't get this to work via the pipeline, but if I type in someones specific email address to get, it works fine.  Any help on the syntax?
    Thanks!
    Get-Mailbox [email protected] | Set-Mailbox -EmailAddresses @{add= $_.Alias + "@TEST"}                                        
    : NOT WORKING.  This just adds "@TEST" to the email addresses
    $test = Get-Mailbox [email protected]
    Get-Mailbox [email protected] | Set-Mailbox -EmailAddresses @{add= $test.Alias + "@TEST"}            : WORKING.  This adds "me@TEST" to the email addresses

    Wow, lots to try!  Thanks for the help.
    Can you help me understand what this is doing?
    @{Add="$($_.Alias)@TEST"}
    I understand $_ is the current object in the pipeline, but how do I interpret the $($_.Alias)?
    Sure, the extra $() surrounding $_.Alias is known as the subexpression operator:
    http://ss64.com/ps/syntax-operators.html
    Basically this allows you to use a property directly inside of a string. It's important to use double quotes in this instance, so the string can expand.
    EDIT: Here's an example you can run with Get-Mailbox:
    Get-Mailbox |
    ForEach { Write-Host "This will append @TEST to the username: $($_.SamAccountName)@TEST" }
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • MacPro RAID card not initiating recovery after defective drive replaced

    One of my artists is using an Early 2009 Mac Pro on 10.9.5 (13F1077). On Saturday morning, while he was not in the office, Drive 1 warned that SMART was reporting early signs of failure. The RAID card degraded the RAID set. I replaced Drive 1 and marked it as a global spare; but recovery is not initiating. I have, subsequent to installing the drive and marking it as a global spare, rebooted the Mac Pro; but the RAID Utility is not showing any Tasks running, and especially nothing about rebuilding the RAID set. As of now, the RAID set and RAID volume are not available. It appears that I can either try to preserve the data on the drives, or I can attempt to manually rebuild the RAID set; but not both. Unfortunately, the artist had all of his projects on the RAID and had not backed them up to servers at the time of the failure.

    If a Disk Fails If a RAID set or volume becomes degraded because a disk has failed, you can use RAID Utility to identify the disk that needs to be replaced.
    Note: If your RAID setup includes a spare drive, it is automatically incorporated into the RAID set, and the set switches from degraded to good as soon as the recovery process finishes. If there is no spare, the set will remain degraded until you replace the failed drive, and if a second drive fails before you replace the first, you could lose data.
    To replace a failed disk:
    1  Open RAID Utility, select the RAID set or volume that is displaying a problem status indicator, and look for a drive bay with a red status indicator. The bay numbers in RAID Utility correspond to the numbered drive bays in your Mac Pro or Xserve.
    2  Replace the bad drive module.
    3  Use the Make Spare command to set up the new drive as a global spare. If no spare was available when the original drive failed, the RAID card uses the new spare immediately to rebuild the affected RAID set and volumes. If a spare was available at the time of the failure, it is already incorporated into the affected RAID set, and the new spare remains available until it is needed.
    https://manuals.info.apple.com/MANUALS/0/MA318/en_US/RAID_Utility_User_Guide.pdf

  • BACKUP LOG suddenly failed with Msg 35250, Level 16, State 11 The connection to the primary replica is not active. The command cannot be processed.

    I have AlwaysOn SQL 2012 Enterprise set-up using Windows Failover Clustering Services (not FCI), and have 1 Primary node (P), 1 Synchronous Commit Auto Failover (SC), and 1 Asynchronous Commit Manual Failover (AC) node.  It is set up to prefer secondary,
    with the highest priority given to AC node.
    I am using Ola Hollengren's scripts for Database Maintenance jobs, including a native BACKUP LOG job for the transaction logs of all user databases on a 1 minute schedule.  His scripts already consider AlwaysOn, and although the job is set-up on all
    3 nodes, only ever runs on AC node.
    The job has been running successfully since initial set-up almost 1 year ago, but suddenly yesterday morning started to fail with the following error, only on 1 of the 13 databases in my availability group:
    Date and time: 2014-06-08 09:36:11
    Command: BACKUP LOG [my_db] TO DISK = N'E:\MSSQL\\Transaction Dumps\my_db\MySQLCL$MySQLAG_my_db_20140608_093610_U_LOG.trn' WITH CHECKSUM, COMPRESSION
    Msg 35250, Level 16, State 11, Server AC, Line 1
    The connection to the primary replica is not active.  The command cannot be processed.
    Msg 3013, Level 16, State 1, Server AC, Line 1
    BACKUP LOG is terminating abnormally.
    Outcome: Failed
    Duration: 00:01:00
    The other 12 databases continued to backup successfully.
    Checking the Availability Group dashboard, windows event logs, and SQL Server error logs, including Failover Cluster events showed no issues.
    However, monitoring software (Idera SQLdm) showed blocked sessions on P node.  When I ran sp_who2, it showed that a background process was being blocked by another background process with an HADR BACKUP LOCK.
    Since both processes were background processes, I was unable to kill either process.  I temporarily disabled the transaction log backup job, but the blocked process was still active.
    I ran DBCC CHECKDB (my_db) WITH all_errormsgs, no_infomsgs, data_purity on both P and AC nodes, with no errors.  However, on AC node, it also showed 1 transaction rolled forward and 0 transactions rolled back.  This also had the effect of releasing
    the blocked background process, but another background process was now blocking with the same HADR BACKUP LOCK.
    I tried to restart SQL Server Agent on AC node, which did not immediately seem to work.  However, after a few minutes, I noticed that the block had disappeared.  I re-enabled the transaction log backup job on AC and it started working normally
    again.  The error has not occurred again, but I am at a loss as to what happened, and how to prevent it from happening again.
    Any help would be greatly appreciated.
    Diane

    And here is part 2 of the stored procedure:
    --// Execute backup commands //--
    WHILE EXISTS (SELECT * FROM @tmpDatabases WHERE Selected = 1 AND Completed = 0)
    BEGIN
    SELECT TOP 1 @CurrentDBID = ID,
    @CurrentDatabaseName = DatabaseName,
    @CurrentDatabaseNameFS = DatabaseNameFS,
    @CurrentDatabaseType = DatabaseType
    FROM @tmpDatabases
    WHERE Selected = 1
    AND Completed = 0
    ORDER BY ID ASC
    SET @CurrentDatabaseID = DB_ID(@CurrentDatabaseName)
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    IF EXISTS (SELECT * FROM sys.database_recovery_status WHERE database_id = @CurrentDatabaseID AND database_guid IS NOT NULL)
    BEGIN
    SET @CurrentIsDatabaseAccessible = 1
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    SELECT @CurrentDifferentialBaseLSN = differential_base_lsn
    FROM sys.master_files
    WHERE database_id = @CurrentDatabaseID
    AND [type] = 0
    AND [file_id] = 1
    -- Workaround for a bug in SQL Server 2005
    IF @Version >= 9 AND @Version < 10
    AND EXISTS(SELECT * FROM sys.master_files WHERE database_id = @CurrentDatabaseID AND [type] = 0 AND [file_id] = 1 AND differential_base_lsn IS NOT NULL AND differential_base_guid IS NOT NULL AND differential_base_time IS NULL)
    BEGIN
    SET @CurrentDifferentialBaseLSN = NULL
    END
    SELECT @CurrentDifferentialBaseIsSnapshot = is_snapshot
    FROM msdb.dbo.backupset
    WHERE database_name = @CurrentDatabaseName
    AND [type] = 'D'
    AND checkpoint_lsn = @CurrentDifferentialBaseLSN
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    SELECT @CurrentLogLSN = last_log_backup_lsn
    FROM sys.database_recovery_status
    WHERE database_id = @CurrentDatabaseID
    END
    SET @CurrentBackupType = @BackupType
    IF @ChangeBackupType = 'Y'
    BEGIN
    IF @CurrentBackupType = 'LOG' AND DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') <> 'SIMPLE' AND @CurrentLogLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'DIFF'
    END
    IF @CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'FULL'
    END
    END
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SELECT @CurrentLatestBackup = MAX(backup_finish_date)
    FROM msdb.dbo.backupset
    WHERE [type] IN('D','I')
    AND is_damaged = 0
    AND database_name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL
    BEGIN
    SELECT @CurrentAvailabilityGroup = availability_groups.name,
    @CurrentAvailabilityGroupRole = dm_hadr_availability_replica_states.role_desc
    FROM sys.databases databases
    INNER JOIN sys.availability_databases_cluster availability_databases_cluster ON databases.group_database_id = availability_databases_cluster.group_database_id
    INNER JOIN sys.availability_groups availability_groups ON availability_databases_cluster.group_id = availability_groups.group_id
    INNER JOIN sys.dm_hadr_availability_replica_states dm_hadr_availability_replica_states ON availability_groups.group_id = dm_hadr_availability_replica_states.group_id AND databases.replica_id = dm_hadr_availability_replica_states.replica_id
    WHERE databases.name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL AND @CurrentAvailabilityGroup IS NOT NULL
    BEGIN
    SELECT @CurrentIsPreferredBackupReplica = sys.fn_hadr_backup_is_preferred_replica(@CurrentDatabaseName)
    END
    SELECT @CurrentDatabaseMirroringRole = UPPER(mirroring_role_desc)
    FROM sys.database_mirroring
    WHERE database_id = @CurrentDatabaseID
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_primary_databases WHERE primary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'PRIMARY'
    END
    ELSE
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_secondary_databases WHERE secondary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'SECONDARY'
    END
    -- Set database message
    SET @DatabaseMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Database: ' + QUOTENAME(@CurrentDatabaseName) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Status: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Standby: ' + CASE WHEN DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Updateability: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Updateability') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'User access: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Is accessible: ' + CASE WHEN @CurrentIsDatabaseAccessible = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Recovery model: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') AS nvarchar) + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group: ' + @CurrentAvailabilityGroup + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group role: ' + @CurrentAvailabilityGroupRole + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Is preferred backup replica: ' + CASE WHEN @CurrentIsPreferredBackupReplica = 1 THEN 'Yes' WHEN @CurrentIsPreferredBackupReplica = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    IF @CurrentDatabaseMirroringRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Database mirroring role: ' + @CurrentDatabaseMirroringRole + CHAR(13) + CHAR(10)
    IF @CurrentLogShippingRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Log shipping role: ' + @CurrentLogShippingRole + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base LSN: ' + ISNULL(CAST(@CurrentDifferentialBaseLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base is snapshot: ' + CASE WHEN @CurrentDifferentialBaseIsSnapshot = 1 THEN 'Yes' WHEN @CurrentDifferentialBaseIsSnapshot = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Last log backup LSN: ' + ISNULL(CAST(@CurrentLogLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = REPLACE(@DatabaseMessage,'%','%%') + ' '
    RAISERROR(@DatabaseMessage,10,1) WITH NOWAIT
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    AND NOT (DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') = 'SINGLE_USER' AND @CurrentIsDatabaseAccessible = 0)
    AND DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 0
    AND NOT (@CurrentBackupType = 'LOG' AND (DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') = 'SIMPLE' OR @CurrentLogLSN IS NULL))
    AND NOT (@CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL)
    AND NOT (@CurrentBackupType IN('DIFF','LOG') AND @CurrentDatabaseName = 'master')
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'N' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'Y' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'DIFF' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'N' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'Y' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT ((@CurrentLogShippingRole = 'PRIMARY' AND @CurrentLogShippingRole IS NOT NULL) AND @CurrentBackupType = 'LOG')
    BEGIN
    -- Set variables
    SET @CurrentDate = GETDATE()
    IF @CleanupTime IS NULL OR (@CurrentBackupType = 'LOG' AND @CurrentLatestBackup IS NULL) OR @CurrentBackupType <> @BackupType
    BEGIN
    SET @CurrentCleanupDate = NULL
    END
    ELSE
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SET @CurrentCleanupDate = (SELECT MIN([Date]) FROM(SELECT DATEADD(hh,-(@CleanupTime),@CurrentDate) AS [Date] UNION SELECT @CurrentLatestBackup AS [Date]) Dates)
    END
    ELSE
    BEGIN
    SET @CurrentCleanupDate = DATEADD(hh,-(@CleanupTime),@CurrentDate)
    END
    SELECT @CurrentFileExtension = CASE
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'FULL' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'DIFF' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'LOG' THEN 'sqb'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'FULL' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'DIFF' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'LOG' THEN 'safe'
    END
    INSERT INTO @CurrentDirectories (ID, DirectoryPath, CreateCompleted, CleanupCompleted)
    SELECT ROW_NUMBER() OVER (ORDER BY ID), DirectoryPath + CASE WHEN RIGHT(DirectoryPath,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END, 0, 0
    FROM @Directories
    ORDER BY ID ASC
    SET @CurrentFileNumber = 0
    SET @CurrentMirrorFilePath = NULL
    WHILE @CurrentFileNumber < @NumberOfFiles
    BEGIN
    SET @CurrentFileNumber = @CurrentFileNumber + 1
    SELECT @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE @CurrentFileNumber >= (ID - 1) * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories) + 1
    AND @CurrentFileNumber <= ID * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories)
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    IF @CurrentFileNumber = 1 AND LEN(@MirrorDirectory) > 0
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    END
    INSERT INTO @CurrentFiles (CurrentFilePath)
    SELECT @CurrentFilePath
    SET @CurrentDirectoryPath = NULL
    SET @CurrentFilePath = NULL
    END
    -- Create directory
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CreateCompleted = 0
    ORDER BY ID ASC
    SET @CurrentCommandType01 = 'xp_create_subdir'
    SET @CurrentCommand01 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_create_subdir N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''' IF @ReturnCode <> 0 RAISERROR(''Error creating directory.'', 16, 1)'
    EXECUTE @CurrentCommandOutput01 = [dbo].[CommandExecute] @Command = @CurrentCommand01, @CommandType = @CurrentCommandType01, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput01 = @Error
    IF @CurrentCommandOutput01 <> 0 SET @ReturnCode = @CurrentCommandOutput01
    UPDATE @CurrentDirectories
    SET CreateCompleted = 1,
    CreateOutput = @CurrentCommandOutput01
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand01 = NULL
    SET @CurrentCommandOutput01 = NULL
    SET @CurrentCommandType01 = NULL
    END
    -- Perform a backup
    IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateOutput <> 0 OR CreateOutput IS NULL)
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP_DATABASE'
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP_LOG'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @Compress = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION'
    IF @Compress = 'N' AND @Version >= 10 SET @CurrentCommand02 = @CurrentCommand02 + ', NO_COMPRESSION'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'xp_backup_database'
    WHEN @CurrentBackupType = 'LOG' THEN 'xp_backup_log'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_database @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    WHEN @CurrentBackupType = 'LOG' THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_log @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    END
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    SET @CurrentCommand02 = @CurrentCommand02 + ''''
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @read_write_filegroups = 1'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CAST(@CompressionLevel AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @buffercount = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @maxtransfersize = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Throttle IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @throttle = ' + CAST(@Throttle AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @cryptlevel = ' + CASE
    WHEN @EncryptionType = 'RC2-40' THEN '0'
    WHEN @EncryptionType = 'RC2-56' THEN '1'
    WHEN @EncryptionType = 'RC2-112' THEN '2'
    WHEN @EncryptionType = 'RC2-128' THEN '3'
    WHEN @EncryptionType = '3DES-168' THEN '4'
    WHEN @EncryptionType = 'RC4-128' THEN '5'
    WHEN @EncryptionType = 'AES-128' THEN '6'
    WHEN @EncryptionType = 'AES-192' THEN '7'
    WHEN @EncryptionType = 'AES-256' THEN '8'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType02 = 'sqlbackup'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION = ' + CAST(@CompressionLevel AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', THREADCOUNT = ' + CAST(@Threads AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', KEYSIZE = ' + CASE
    WHEN @EncryptionType = 'AES-128' THEN '128'
    WHEN @EncryptionType = 'AES-256' THEN '256'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand02,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType02 = 'BACKUP_DATABASE'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType02 = 'xp_ss_backup'
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_backup @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    IF @CurrentMirrorFilePath IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @mirrorfile = N''' + @CurrentMirrorFilePath + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ', @backuptype = ' + CASE WHEN @CurrentBackupType = 'FULL' THEN '''Full''' WHEN @CurrentBackupType = 'DIFF' THEN '''Differential''' WHEN @CurrentBackupType = 'LOG' THEN '''Log''' END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @readwritefilegroups = 1'
    SET @CurrentCommand02 = @CurrentCommand02 + ', @checksum = ' + CASE WHEN @CheckSum = 'Y' THEN '1' WHEN @CheckSum = 'N' THEN '0' END
    SET @CurrentCommand02 = @CurrentCommand02 + ', @copyonly = ' + CASE WHEN @CopyOnly = 'Y' THEN '1' WHEN @CopyOnly = 'N' THEN '0' END
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CASE WHEN @CompressionLevel = 5 THEN N'ispeed' WHEN @CompressionLevel = 6 THEN N'isize' ELSE CAST(@CompressionLevel AS nvarchar) END
    IF @RetryWrites IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @retrywrites = N''' + @RetryWrites + ''''
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptiontype = N''' + CASE
    WHEN @EncryptionType = 'AES-128' THEN 'AES128'
    WHEN @EncryptionType = 'AES-256' THEN 'AES256'
    END + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptedbackuppassword = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput02 = [dbo].[CommandExecute] @Command = @CurrentCommand02, @CommandType = @CurrentCommandType02, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput02 = @Error
    IF @CurrentCommandOutput02 <> 0 SET @ReturnCode = @CurrentCommandOutput02
    END
    -- Verify the backup
    IF @CurrentCommandOutput02 = 0 AND @Verify = 'Y'
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType03 = 'xp_restore_verifyonly'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_restore_verifyonly'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    SET @CurrentCommand03 = @CurrentCommand03 + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType03 = 'sqlbackup'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand03,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType03 = 'xp_ss_verify'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_verify @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand03 = @CurrentCommand03 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput03 = [dbo].[CommandExecute] @Command = @CurrentCommand03, @CommandType = @CurrentCommandType03, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput03 = @Error
    IF @CurrentCommandOutput03 <> 0 SET @ReturnCode = @CurrentCommandOutput03
    END
    -- Delete old backup files
    IF (@CurrentCommandOutput02 = 0 AND @Verify = 'N' AND @CurrentCleanupDate IS NOT NULL)
    OR (@CurrentCommandOutput02 = 0 AND @Verify = 'Y' AND @CurrentCommandOutput03 = 0 AND @CurrentCleanupDate IS NOT NULL)
    BEGIN
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CleanupCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CleanupCompleted = 0
    ORDER BY ID ASC
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType04 = 'xp_slssqlmaint'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_slssqlmaint N''-MAINTDEL -DELFOLDER "' + REPLACE(@CurrentDirectoryPath,'''','''''') + '" -DELEXTENSION "' + @CurrentFileExtension + '" -DELUNIT "' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + '" -DELUNITTYPE "minutes" -DELUSEAGE'' IF @ReturnCode <> 0 RAISERROR(''Error deleting LiteSpeed backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType04 = 'sqbutility'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqbutility 1032, N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''', N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + CASE WHEN @CurrentBackupType = 'FULL' THEN 'D' WHEN @CurrentBackupType = 'DIFF' THEN 'I' WHEN @CurrentBackupType = 'LOG' THEN 'L' END + ''', ''' + CAST(DATEDIFF(hh,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'h'', ' + ISNULL('''' + REPLACE(@EncryptionKey,'''','''''') + '''','NULL') + ' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLBackup backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType04 = 'xp_ss_delete'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_delete @filename = N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + '\*.' + @CurrentFileExtension + ''', @age = ''' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'Minutes'' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLsafe backup files.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput04 = [dbo].[CommandExecute] @Command = @CurrentCommand04, @CommandType = @CurrentCommandType04, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput04 = @Error
    IF @CurrentCommandOutput04 <> 0 SET @ReturnCode = @CurrentCommandOutput04
    UPDATE @CurrentDirectories
    SET CleanupCompleted = 1,
    CleanupOutput = @CurrentCommandOutput04
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand04 = NULL
    SET @CurrentCommandOutput04 = NULL
    SET @CurrentCommandType04 = NULL
    END
    END
    END
    -- Update that the database is completed
    UPDATE @tmpDatabases
    SET Completed = 1
    WHERE Selected = 1
    AND Completed = 0
    AND ID = @CurrentDBID
    -- Clear variables
    SET @CurrentDBID = NULL
    SET @CurrentDatabaseID = NULL
    SET @CurrentDatabaseName = NULL
    SET @CurrentBackupType = NULL
    SET @CurrentFileExtension = NULL
    SET @CurrentFileNumber = NULL
    SET @CurrentDifferentialBaseLSN = NULL
    SET @CurrentDifferentialBaseIsSnapshot = NULL
    SET @CurrentLogLSN = NULL
    SET @CurrentLatestBackup = NULL
    SET @CurrentDatabaseNameFS = NULL
    SET @CurrentDatabaseType = NULL
    SET @CurrentDate = NULL
    SET @CurrentCleanupDate = NULL
    SET @CurrentIsDatabaseAccessible = NULL
    SET @CurrentAvailabilityGroup = NULL
    SET @CurrentAvailabilityGroupRole = NULL
    SET @CurrentIsPreferredBackupReplica = NULL
    SET @CurrentDatabaseMirroringRole = NULL
    SET @CurrentLogShippingRole = NULL
    SET @CurrentCommand02 = NULL
    SET @CurrentCommand03 = NULL
    SET @CurrentCommandOutput02 = NULL
    SET @CurrentCommandOutput03 = NULL
    SET @CurrentCommandType02 = NULL
    SET @CurrentCommandType03 = NULL
    DELETE FROM @CurrentDirectories
    DELETE FROM @CurrentFiles
    END
    --// Log completing information //--
    Logging:
    SET @EndMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120)
    SET @EndMessage = REPLACE(@EndMessage,'%','%%')
    RAISERROR(@EndMessage,10,1) WITH NOWAIT
    IF @ReturnCode <> 0
    BEGIN
    RETURN @ReturnCode
    END
    END
    GO
    ALTER AUTHORIZATION ON [dbo].[DatabaseBackup] TO SCHEMA OWNER
    GO
    Diane

Maybe you are looking for

  • MTS video files

    How do I import MTS video files from my Sony Handycam HDR-CX160E into Premiere Elements Quick Editor?

  • Can I retrieve cursor's value with variable columns?

    I have a loop to check a bunch of columns in a cursor, I'd like to use a variable columns like following: cursor cur while .... loop cur.XXX end loop; here XXX are dynamical generated VARCHAR2. Could you please tell me is it possible, or not? Thanks

  • Whether or not to include ADF Runtime Library

    Hello all, My company is about to get started using JDeveloper and JHeadstart. We have to make a decision whether or not to include the ADF Runtime Library in each application during deployment. Does anyone have advice and experience on this topic? W

  • Query on 2 tables

    Hi, Suppose I have 2 tables students and clubmembers I didn't create a one-to-one mapping between them. Both tables have attribute id_n. How do I write a TopLink Query such that it satisfies the following sql statement : select * from students where

  • Webi Report Data compare between two columns

    There is two different queries in Webi Report BI 4.1 Query 1 - Name_1 == 100 records Query 2 - Name_2 == 75 records On the report need to compare the data between Name_1 and Name_2. Need report level flag as a second column name_1 = name_2 = Y name_1