Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Save-ScreenSaver
  2. { Param([parameter(Mandatory=$true)]
  3.             [String]
  4.             $dbPath,
  5. #        [parameter(Mandatory=$true,
  6. #                      ValueFromPipelineByPropertyName=$true)]
  7. #            [DateTime]
  8. #            $Epoch,
  9.         [parameter(Mandatory=$true,
  10.                       ValueFromPipelineByPropertyName=$true)]
  11.             [String[]]
  12.             $__PATH,
  13.         [parameter(Mandatory=$true,
  14.                    ValueFromPipelineByPropertyName=$true)]
  15.             [Boolean]
  16.             $ScreenSaverActive,
  17.         [parameter(Mandatory=$true,
  18.                    ValueFromPipelineByPropertyName=$true)]
  19.             [String]
  20.             $ScreenSaverExecutable,
  21.         [parameter(Mandatory=$true,
  22.                    ValueFromPipelineByPropertyName=$true)]
  23.             [Boolean]
  24.             $ScreenSaverSecure,
  25.         [parameter(Mandatory=$true,
  26.                    ValueFromPipelineByPropertyName=$true)]
  27.             [UInt32]
  28.             $ScreenSaverTimeout
  29.     )
  30.   Begin {
  31.    $connection = New-Object System.Data.OleDb.OleDbConnection
  32.    $connection.ConnectionString =
  33.    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$dbPath;Persist Security Info=False"
  34.    $connection.Open()  
  35.   }
  36. $command = New-Object System.Data.OleDb.OleDbCommand
  37. $command.Connection = $connection
  38. $command.CommandText = "INSERT INTO Screen" +
  39.                        "(__PATH, ScreenSaverActive, ScreenSaverExecutable, " +
  40.                        "ScreenSaverSecure, ScreenSaverTimeout) " +
  41.                        "VALUES(?, ?, ?, ?, ?)"
  42.   Process {
  43.    # Ejecutar el command, asignando primeramente los parĂ¡metros
  44.    # recibidos del pipe"
  45.   }
  46.  
  47.   End {
  48.    $connection.Close()
  49.   }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement