Showing posts with label PowerShell. Show all posts

ON THE FLY COMPRESSION/UNCOMPRESSION IS EASY ON UNIX, BUT ALSO ON WINDOWS  

Posted by ReelTym

Link to full article

ON THE FLY COMPRESSION IS EASY ON UNIX, BUT IT IS ALSO EASY ON WINDOWS

There are a number of situations where the output results of a program become the input data for other program (for example you may want to compress your backup file with gzip tool and the compressed file be encrypted with Rijndael algorithm using GNU aes tool)

When both programs support stdin and stdout as a mechanism for input output, you can easily pipe the output of the first program to the input of the second program at the command line. For example

gzip –c mybackupfile.bkp | aes –e -p mypass -o mybackupfile.bkp.gz.enc

Unfortunately, this is not always the case and some programs don’t accept stdin and stdout for data input output (this is the case of Oracle import/export tools or Microsoft bcp tool).

On Unix environments these cases have been typically solved using mknod tool to create an OS file pipe. Once the pipe is created, the first program is able to write its output results to the pipe as if it was a normal file and the second program is able to read data from that pipe as if it was a normal file.

As an example, here you can find a largely used script by Oracle DBA to perform on the fly compression of an export operation

# Make a pipe
mknod expdat.dmp p
# Start compress the pipe in background
gzip -c < expdat.dmp > expdat.dmp.gz &
# Wait start the export
sleep 5
# Start the export
exp scott/tiger file=expdat.dmp

As far as I know, there is no similar native way to perform this operation on Microsoft Windows operating system.

I started thinking on it and finally I got a simple solution using Microsoft Windows pipes, zlib library (http://www.zlib.net/zlib123-dll.zip ) and a couple of small tools (less than 100 lines of code each of them)  I wrote: ZipPipe.exe and UnZipPipe.exe.

In point 1, I will show several uses of these tools, basically how to perform on the fly compression using Oracle imp and exp tools.
To get the necessary bin files (ZipPipe.exe, UnZipPipe.exe and zlib1.dll I would suggest to read point 2 and 3 of this document, but if you have any problem to obtain these files, just drop me an e-mail at jcarlossaez1@hotmail.com
Note: You can obtain a compiled version of these tools from http://cid-b3378f057444b65c.skydrive.live.com/self.aspx/P%c3%bablico/ZipPipe/zippipe.zip You don´t need anything more than these to run the tools.

1 HOW TO USE ZipPipe AND UnZipPipe TOOLS


1.1 On the Fly compression with Oracle Exp and Imp tools


On Unix environments, it has been largely used scripts allowing on the fly compression of the dump file generated by exp utility.
In the same way, on the fly decompression can be achieved to perform import operations reading directly from a compressed file.

A typical script to perform on the fly compression for the data generated by exp utility is

# Make a pipe
mknod expdat.dmp p
# Start compress the pipe in background
gzip -c < expdat.dmp > expdat.dmp.gz &
# Wait start the export
sleep 5
# Start the export
exp scott/tiger file=expdat.dmp

A typical script to execute an import operation reading directly from a compressed file is 

# Make a pipe
mknod expdat.dmp p
# Start decompress to the pipe in background
gzip -c < expdat.dmp.gz > expdat.dmp > &
# Wait start the import
sleep 5
# Start the import
imp scott/tiger file=expdat.dmp

There is no way to accomplish this work in the same way on Windows platforms. When exporting you first export to a normal file and then, you can compress it (except using NTFS built-in compression capabilities, but this is not what we are looking for)
When importing, you need first decompress the file and then you can import the file.

However, whit the ZipPipe and UnZipPipe tools, you can achieve the same behaviour as you have on Unix.

How to perform on the fly compression while exporting on Windows platforms?

Until now, your bat scripts looks something similar to this

exp scott/tiger file=expdat.dmp
gzip  expdat.dmp expdat.dmp.gz

Only when exp tool finishes its job, you can start compressing the file. This way needs more disk space and in most of the cases more time.

Look how you can export and compress without any intermediate file

start /MIN ZipPipe EXPPIPE expdat.dmp.gz 9
exp scott/tiger file= \\.\pipe\EXPPIPE

The first line starts our “compressor engine” that listens on named pipe \\.\pipe\EXPPIPE and writes the compressed information to the file expdat.dmp.gz  with a compression level of 9 (compression level can be in the range 1 to 9)
When export tool completes the export operation, ZipPipe process detects it and ends

How to perform on the fly decompression while importing on Windows platforms?

Until now, your bat scripts looks something similar to this

gzip –d expdat.dmp.gz expdat.dmp
imp scott/tiger file=expdat.dmp

Only when decompressor tool finishes its job, you can start importing the file. This way needs more disk space and in most of the cases more time.

Look how you can import and decompress without any intermediate file

start /MIN UnZipPipe IMPPIPE expdat.dmp.gz
imp scott/tiger file= \\.\pipe\IMPIPE

The first line starts our “decompressor engine” that listens that reads from the compressed file expdat.dmp.gz and writes the decompressed information to named pipe \\.\pipe\IMPPIPE
When import tool completes the import operation, UnZipPipe process detects it and ends.

You can think on ZipPipe and UnZipPipe as the equivalent tool to mknod plus gzip in the Unix environment.
Of course, you can make many remarks to this solution, but it allows you to achieve the same functionality you have on Unix, saving lot of space in Disks and most of the times reducing import/export duration.

One more thing: it is a pity these tools don’t work with new expdp and impdp tools available in Oracle10g. But don’t blame to Microsoft Windows or to these tools themselves. You won’t be able to perform on the fly compression with these new tools on Unix environments too. It is due to a change in the design of these tools. (And don’t get wrong with the COMPRESS parameter of these new tools. This parameter only compresses metadata).

1.2 On the Fly compression with Microsoft bcp tool

What a terrible pity! I have been able to use these tools only to on the fly compress the output of the bcp in native format.
I can not use them for on the fly decompression when using bcp to import or even when downloading data in no native format.
Perhaps someone can make them work.

How do you use bcp to export pubs..authors table to an uncompressed file and then compress?

Typically, at the command prompt in the source SQL Server you only need to type:

            bcp  pubs..authors out  authors.txt -T –n
            gzip authors.txt authors.txt.gz

The first command exports the data and the second one compress the generated file using gzip tool

Note that during the process you need enough space to store authors.txt and authors.txt.gz simultaneously provided that at the end you can delete the uncompressed file.

How can you use bcp and ZipPipe to export pubs..authors table directly to a compressed file?

At the command prompt in the source SQL Server you only need to type:

            start /MIN ZipPipe authors_pipe authors.txt.gz 9
            bcp  pubs..authors out  \\.\pipe\authors_pipe -T -n

The first command starts our compressor tool (you can think this step is similar to create a pipe and start the background compressor in the Unix environment all in one step).
Second, you only need to start bcp tool, but giving the pipe \\.pipe\ authors_pipe  as the file name where bcp has to write.

Another  process is launched. This background process is our compressor tool that creates and listens on named pipe \\.pipe\ authors_pipe and saves the data once compressed in the file authors.txt.gz. This process automatically ends when bcp completes export operation.

And you can see how file authors.txt.gz is the only file generated in one step.

Rest of the article where you can find how to build these tools
 http://spaces.msn.com/members/jcarlossaez/Blog/cns!1phQKLZOcIUsN9Tj5QObzgdw!112.entry

Command line reference: Database and Operating Systems  

Posted by ReelTym

                 
  Oracle   Oracle database
dict.
  CMD Commands   Windows XP
+ Resource Kits, Robocopy
 
  Bash   BASH
GNU Linux
  VBScript   VBScript Commands  
  OS X Commands   OS X commands
Leopard 10.5
  Powershell   Windows PowerShell  
  Forum   Discussion
Forums
  SQL Server   SQL Server database  
                 

POWERSHELL: An A-Z Index of Windows PowerShell commands  

Posted by ReelTym

a
    Get-Acl                   Get permission settings for a file or registry key
    Set-Acl                   Set permissions
    Get-Alias           gal   Return alias names for Cmdlets
 Import-Alias          ipal   Import an alias list from a file
    New-Alias           nal   Create a new alias.
    Set-Alias           sal   Create or change an alias
   Get-AuthenticodeSignature  Get the signature object associated with a file
   Set-AuthenticodeSignature  Place a signature in a .ps1 script or other file
c
   Set-Location  cd/chdir/sl  Set the current working location
   Get-ChildItem   dir/ls/gci Get child items (contents of a folder or registry key)
     Clear-Host    clear/cls  Clear the screen
     Clear-Item         cli   Remove content from a variable or an alias
       Get-Command      gcm   Retrieve basic information about a command
   Measure-Command            Measure running time
     Trace-Command            Trace an expression or command
        Add-Computer          Add a computer to the domain
 Checkpoint-Computer          Create a system restore point (XP)
    Restore-Computer          Restore the computer to a previous state
     Add-Content         ac   Add to the content of the item
     Get-Content cat/type/gc  Get content from item (specific location)
     Set-Content         sc   Set content in the item (specific location)
   Clear-Content        clc   Remove content from a file/item
     Get-Command        gcm   Get basic information about cmdlets
  Invoke-Command        icm   Run command
   Enable-ComputerRestore     Enable System Restore on a drive
   Disable-ComputerRestore    Disable System Restore on a drive
   Get-ComputerRestorePoint   Get the restore points on the local computer
   ConvertFrom-CSV            Convert object properties (in CSV format) into CSV objects
   ConvertTo-CSV              Convert .NET Framework objects into CSV variable-length strings
   ConvertTo-Html             Convert the input into an HTML table
   ConvertTo-Xml              Convert the input into XML
   ConvertFrom-SecureString   Convert a secure string into an encrypted standard string
   ConvertTo-SecureString     Convert an encrypted standard string into a secure string
   Copy-Item     copy/cp/ci   Copy an item from a namespace location
   Export-Counter             Export Performance Counter data to log files
      Get-Counter             Get performance counter data
   Import-Counter             Import performance counter log files

   Get-Credential             Get a security credential (username/password)
   Get-Culture                Get region information (language and keyboard layout)
d
   Get-ChildItem   Dir/ls/gci Get child items (contents of a folder or registry key)
   Get-Date                   Get current date and time
   Set-Date                   Set system time on the host system
   Remove-Item  Del/erase/rd/rm/rmdir   Delete an item
   Compare-Object diff/compare   Compare the properties of objects
   Do                         Loop while a condition is True
e
     Get-Event                Get events in the event queue
     Get-WinEvent             Get events from event logs and event trace logs
     New-Event                Create a new event
  Remove-Event                Delete events from the event queue
 Unregister-Event             Cancel an event subscription
   Clear-EventLog             Delete all entries from an event log
     Get-Eventlog             Get event log data
     New-Eventlog             Create a new event log and a new event source
  Remove-EventLog             Delete an event log
   Get-EventSubscriber        Get event subscribers
Register-EngineEvent          Subscribe to powershell events
Register-ObjectEvent          Subscribe to .NET events
   Register-WmiEvent          Subscribe to a WMI event
   Get-ExecutionPolicy        Get the execution policy for the shell
   Set-ExecutionPolicy        Change the execution policy (user preference)
   Export-Alias         epal  Export an alias list to a file
   Export-Clixml              Produce a clixml representation of powershell objects
   Export-Console             Export console configuration to a file
   Export-Csv          epcsv  Export to Comma Separated Values (spreadsheet)
   Exit                       Exit Powershell (or exit a script)
f
   ForEach-Object    foreach  Loop for each object in the pipeline ( % )
   ForEach                    Loop through values in the pipeline
   For                        Loop through items that match a condition
   Format-Custom         fc   Format output using a customized view
   Format-List           fl   Format output as a list of properties, each on a new line
   Format-Table          ft   Format output as a table
   Format-Wide           fw   Format output as a table listing one property only
  Export-FormatData           Save formatting data from the current session 
     Get-FormatData           Get the formatting data in the current session
g
   Get-Item              gi   Get a file/registry object (or any other namespace object)
   Get-ChildItem   dir/ls/gci Get child items (contents of a folder or registry key)
h
   Get-Help            help   Open the help file
     Add-History              Add entries to the session history
   Clear-History       clhy   Delete entries from the session history
     Get-History  history/h/ghy Get a listing of the session history
  Invoke-History     r/ihy    Invoke a previously executed Cmdlet
     Get-Host                 Get host information (PowerShell Version and Region)
   Clear-Host      clear/cls  Clear the screen
    Read-Host                 Read a line of input from the host console
   Write-Host                 Display message on screen
     Get-HotFix               Get Installed hotfixes
i
   if                         Conditionally perform a command
   Import-Clixml              Import a clixml file and rebuild the PS object
   Import-Csv         ipcsv   Take values from a CSV list and send objects down the pipeline.
      Get-Item           gi   Get a file object or get a registry (or other namespace) object
   Invoke-Item           ii   Invoke an executable or open a file (START)
   Invoke-Expression    iex   Run a PowerShell expression
      New-Item           ni   Create a new item in a namespace
   Remove-Item  rm/del/erase/rd/ri/rmdir   Remove an item
      Set-Item           si   Change the value of an item
    Clear-ItemProperty  clp   Remove the property value from a property
     Copy-ItemProperty  cpp   Copy a property along with it's value
      Get-ItemProperty   gp   Retrieve the properties of an object
     Move-ItemProperty   mp   Move a property from one location to another
      New-ItemProperty        Set a new property
   Remove-ItemProperty   rp   Remove a property and its value
   Rename-ItemProperty  rnp   Renames a property at its location
      Set-ItemProperty   sp   Set a property at the specified location to a specified value
j
       Get-Job          gjb   Get PowerShell background jobs that are running
   Receive-Job         rcjb   Get PowerShell background job results
    Remove-Job          rjb   Delete a PowerShell background job
     Start-Job         sajb   Start a PowerShell background job
      Stop-Job         spjb   Stop a PowerShell background job
      Wait-Job          wjb   Wait for background job
k
   Stop-Process    kill/spps  Stop a running process
l
   Get-Location    pwd / gl   Get and display the current location
   Pop-Location        popd   Set the current working location from the stack
  Push-Location       pushd   Push a location to the stack
   Set-Location  cd/chdir/sl  Set the current working location
m
   Add-Member                 Add a member to an instance of a PowerShell object
   Get-Member            gm   Enumerate the properties of an object
    Get-Module          gmo   Get the modules imported to the session
 Import-Module         ipmo   Add a module to the session
    New-Module          nmo   Create a new dynamic module (only in memory)
 Remove-Module          rmo   Remove a module from the current session
   Move-Item      mv/move/mi  Move an item from one location to another
o
  Compare-Object diff/compare Compare the properties of objects
    Group-Object       group  Group objects that contain the same value
  Measure-Object              Measure the properties of an object
      New-Object              Create a new .Net object
   Select-Object      select  Select properties of objects
     Sort-Object        sort  Sort objects by property value
    Where-Object              Filter the objects passed along the command pipeline
   Out-Default                Send output to default
   Out-File                   Send command output to a file
   Out-GridView         ogv   Send output to an interactive table
   Out-Host              oh   Send the pipelined output to the host
   Out-Null                   Send output to null
   Out-Printer           lp   Send the output to a printer
   Out-String                 Send objects to the host as strings
p
   Powershell                 Launch a powershell session
   Convert-Path        cvpa   Convert a ps path to a provider path
      Join-Path               Combine a path and child-path
   Resolve-Path        rvpa   Resolves the wildcards in a path
     Split-Path               Return part of a path
      Test-Path               Return true if the path exists, otherwise return false
 Get-Pfxcertificate         Get pfx certificate information
    Pop-Location       popd   Set the current working location from the stack
   Push-Location      pushd   Push a location to the stack
     Get-Process     ps/gps   Get a list of processes on a machine
   Debug-Process              Attach a debugger to a running process
   Start-Process  start/saps  Start one or more processes
    Stop-Process   kill/spps  Stop a running process
   Enable-PSBreakpoint  ebp   Enable a breakpoint in the current console
  Disable-PSBreakpoint  dbp   Disable a breakpoint in the current console
      Get-PSBreakpoint  gbp   Get the currently set breakpoints
      Set-PSBreakpoint  sbp   Set a breakpoint on a line, command, or variable
   Remove-PSBreakpoint  rbp   Delete breakpoints from the current console
      Get-PSDrive       gdr   Get drive information (DriveInfo)
      New-PSDrive   mount/ndr Install a new drive on the machine
   Remove-PSDrive       rdr   Remove a provider/drive from its location
      Get-PSProvider          Get information for the specified provider
      Set-PSdebug             Turn script debugging on or off
    Enter-PSSession  etsn     Start an interactive session with a remote computer
     Exit-PSSession  exsn     End an interactive session with a remote computer
   Export-PSSession  epsn     Import commands and save them in a PowerShell module
      Get-PSSession   gsn     Get the PSSessions in the current session
   Import-PSSession  ipsn     Import commands from another session
      New-PSSession   nsn     Create a persistent connection to a local or remote computer
   Remove-PSSession   rsn     Close PowerShell sessions
    Disable-PSSessionConfiguration  Deny access to PS session configuration
     Enable-PSSessionConfiguration  Enable PS session configuration
        Get-PSSessionConfiguration  Get the registered PS session configuration
   Register-PSSessionConfiguration  Create and register a new PS session configuration
 Unregister-PSSessionConfiguration  Delete registered PS session configuration
   Add-PsSnapIn        asnp   Add snap-ins to the console
   Get-PsSnapin        gsnp   List PowerShell snap-ins on this computer
   Remove-PSSnapin     rsnp   Remove PowerShell snap-ins from the console
q
   Quest AD cmdlets           Read and write to Active Directory
r
   Read-Host                  Read a line of input from the host console
   Remove-Item  rm/del/erase/rd/ri/rmdir   Remove an item
   Rename-Item      ren/rni   Change the name of an existing item
   Rename-ItemProperty        Rename a property of an item
   Run/Call             &     Run a command (call operator)
s
   Select-Object     select   Select properties of objects
       Get-Service      gsv   Get a list of services
       New-Service            Create a new service
   Restart-Service            Stop and then restart a service
    Resume-Service            Resume a suspended service
       Set-Service            Change the start mode/properties of a service
     Start-Service     sasv   Start a stopped service
      Stop-Service     spsv   Stop a running service
   Suspend-Service            Suspend a running service
   Sort-Object         sort   Sort objects by property value
   Start-Sleep        sleep   Suspend shell, script, or runspace activity
   Switch                     Multiple if statements
   ConvertFrom-StringData     Convert a here-string into a hash table
   Select-String              Search through strings or files for patterns
t
   Tee-Object           tee   Send input objects to two places
   New-Timespan               Create a timespan object
   Trace-Command              Trace an expression or command
   Get-Tracesource            Get components that are instrumented for tracing.
   Set-Tracesource            Trace a PowerShell component
     Start-Transaction        Start a new transaction 
  Complete-Transaction        Commit the transaction
       Get-Transaction        Get information about the active transaction
       Use-Transaction        Add a command or expression to the transaction
      Undo-Transaction        Roll back a transaction
   Start-Transcript           Start a transcript of a command shell session
    Stop-Transcript           Stop the transcription process
   Add-Type                   Add a .NET Framework type to a PowerShell session
   Update-TypeData
u
   Get-Uiculture              Get the ui culture information
   Get-Unique            gu   Get the unique items in a collection
    Update-Formatdata         Update and append format data files
    Update-Typedata           Update the current extended type configuration
v
   Clear-Variable       clv   Remove the value from a variable
     Get-Variable        gv   Get a powershell variable
     New-Variable        nv   Create a new variable
  Remove-Variable        rv   Remove a variable and its value
     Set-Variable    set/sv   Set a variable and a value
w
   Where-Object      where/?  Filter input from the pipeline
   Where                      Filter objects from the pipeline
   While                      Loop while a condition is True
   Write-Debug                Write a debug message to the host display
   Write-Error                Write an object to the error pipeline.
   Write-Output   write/echo  Write an object to the pipeline
   Write-Progress             Display a progress bar
   Write-Verbose              Write a string to the host's verbose display
   Write-Warning              Write a warning message
    Set-WmiInstance           Create or update an instance of an existing WMI class
 Invoke-WmiMethod      iwmi   Call WMI methods
    Get-WmiObject      gwmi   Get WMI class information
 Remove-WmiObject      rwmi   Delete an instance of a WMI class
    Connect-WSMan             Connect to the WinRM service on a remote computer
 Disconnect-WSMan             Disconnect from the WinRM service on a remote computer
       Test-WSMan             Test whether the WinRM service is running
  Invoke-WSManAction          Invoke an action on a specified object
 Disable-WSManCredSSP         Disable Credential Security Service Provider (SSP) authentication
  Enable-WSManCredSSP         Enable Credential SSP authentication
     Get-WSManCredSSP         Get the Credential SSP configuration
   New-WSManInstance                                                                                                         
   Get-WSManInstance          Display management information (XML or value)
   Set-WSManInstance          Modify the management information related to a resource
   Set-WSManQuickConfig       Configure the local computer for remote management
   New-WSManSessionOption
   #                          Comment / Remark
   ?                          Alias for Where-Object
   $variable = "value"        Define a variable  also: ${n!a#me} = "value"
   @(...)                     Force an expression to be evaluated as an array


The cmdlets on this page are listed in A-Z order, matching either the Verb- or -Noun or Alias of the cmdlet (some are listed more than once).


In addition to the above, Powershell can also run all the standard CMD commands (apart from internal commands), plus VBScript and Resource kit utilities.


Related:
   Microsoft: PowerShell 2.0 core and PowerShell Scripting help Exchange 2010 cmdlets SQL Server 2008
   Discussion forum,
   Links to other websites, books etc...

Restore-SqlDb - Automate a Database Restore (improved with Powershell)  

Posted by ReelTym

This new PoSh version of the script supports everything from the original script plus other features like allowing a restore to be automated/initiated from any machine (as opposed to having to be on the server itself), restoring from one instance to another instance, simply outputting a script of the restore statement(s) and/or execute the restore, removing the dependency on using things like xp_cmdshell, supports SQL 2005 and 2008, exclude differential and/or log backups if you like, and a few others as well. On the PoSh side, this script supports all the major considerations any good PoSh script should such as:


  • Can be dot-sourced into a script

  • Can be invoked from a script (i.e. &restore-sqldb)

  • Fully supports pipeline processing for SMO Database objects and/or any object that can be string-expanded to a database name

  • Friendly usage output (run the script with a single '-?' parameter)

  • Debug and Verbose optional output

  • I don't support a -whatIf directly, but you get this by basically excluding the -execute switch (you'll get a restore script output)


If you haven't read the original script post, I'd encourage you to take a look at it quickly (the text of the blog post, not necessarily the script) to give you an idea of what can be done with the script and hence this script - some of the functionality included allows for things like:


  • Restore a database with nothing more for information than what database and what instance it resides on

  • By default will pull restore information from the msdb database for the instance being restored from. This will basically query the appropriate backup meta-data tables for backup information on the database in question and build the restore statement(s) from that data appropriately including proper ordering, grouping of media sets/families, etc.

  • Can specify '-paths' that support wildcards and can include 1 or more locations to backup files for the database in question - the backup files will be:

    • Investigated for proper ordering of restore sequence

    • Expanded (if they are backup set files containing multiple backups) appropriately

    • Grouped correctly if part of a media family/set (i.e. if you use a backup statement with multiple output files)



  • Can now restore from one instance to a totally different instance (obviously you need to be able to connect to each and have appropriate privileges to do so)

    • Use the '-fromInstance' parameter to specify where to restore from

    • Use the '-toInstance' parameter to specify where to restore to



  • Can specify a new location to move log file(s) to during the restore - this will build the appropriate 'with move...' statement(s) into the restore script to move log files to the specified location(s)

    • o You do not need to know anything about where the log file(s) already existed within the backup



  • Can specify new location(s) to move data file(s) to during the restore - this will build the appropriate 'with move...' statement(s) into the restore script to move data files to the specified location(s)

    • You do not necessarily need to include the same number of new locations as existing locations - if there are more data files than new locations, the script will simply round-robin the data files among the new locations

    • You do not need to know anything about where the data file(s) already existing within the backup



  • You can specify a '-stopAt' value that will mimic the 'STOPAT' statement within the restore

  • You can choose to ignore differential backups and/or log backups - by default the script uses all possible backups, this provides some flexibility

  • You can perform a page restore that will pull pages to be restored automatically from the msdb.dbo.suspect_pages table

  • You can perform a restore of only specific files or filegroups - simply include the appropriate logical filenames and/or filegroup names in the '-files' and '-filegroups' parameters

  • If you don't want to incur the overhead of a restore headeronly/filelist only operation and you write backups with a timestamp, you can specify the '-timeStampInFileNames' option and the script will shred each filename for a timestamp value that will act as the ordering/grouping values instead of performing a restore headeronly/filelistonly operation on each

  • Can restore the database with a new name via the '-newDbName' parameter

  • Support for liteSpeed syntax via the '-liteSpeed' switch

  • Checksum support via the '-checksum' switch

  • And much more...(just like on TV)


For those of you familiar with PoSh arguments, you realize you don't have to necessarily include the entire name of a script parameter, just enough of it so the PoSh engine can distinguish it from the other parameter names - this will allow you to short-hand things like the '-toInstance' parameter to just '-to', or the '-fromInstance' to just '-from', or the '-dbName' parameter to just '-db', or just '-lite' for liteSpeed vs. the full '-liteSpeed', or...well, you get the picture.

For detailed usage scenarios and some examples, just PoSh Restore-SqlDb.ps1 -?.

Enjoy!