$datetime = Get-Date -Format yyyyMMddhhmm
![azure data studio powershell 6 notebook azure data studio powershell 6 notebook](https://docs.microsoft.com/pt-br/azure/active-directory/reports-monitoring/media/reference-powershell-reporting/get-azureadauditdirectorylogs.png)
Example 4: Execute Notebook Against All Registered Servers dir 'SQLSERVER:\SQLRegistration\Database Engine Server Group' | This is the same as Example 1, only that the connection to the server is specified via the -ConnectionString parameter. Example 3: Execute Notebook using -ConnectionString parameter PS C:\> Invoke-Sqlnotebook -ConnectionString 'Server=Localhost Database=TestNotebook Trusted_Connection=True ' -InputFile C:\notebook.ipynb The executed notebook is then saved to the file specified with the -OutputFile parameter. This command runs the notebook against the default instance of SQL Server running on the the machine where the cmdlet is executed from.īy default, since no -OutputFile was passed in, the materialized notebook is saved on disk with the same name as the InputFile withĪ _out as a suffix to the filename (notebook.ipynb -> notebook_out.ipynb) Example 2: Execute Notebook on the local server (defaut instance) and saves the materialized Notebook to a specified file PS C:\> Invoke-SqlNotebook -ServerInstance localhost -Database TestNotebook -InputFile C:\notebook.ipynb -OutputFile C:\new_notebook.ipynb Examples Example 1: Execute a Notebook against the local server (default instance) PS C:\> Invoke-SqlNotebook -ServerInstance localhost -Database TestNotebook -InputFile C:\notebook.ipynb
![azure data studio powershell 6 notebook azure data studio powershell 6 notebook](https://blog.robsewell.com/assets/uploads/2019/10/image-19.png)
The cmdlet outfile may be omitted: if that's the case, it will be created with the input file name and the _out appended to the file. When the cmdlet is run, the resulting Notebook file will be in the location the user defines or in the same directory of the input notebook file. The Notebook will be executed on the ServerInstance and Database provided.
![azure data studio powershell 6 notebook azure data studio powershell 6 notebook](https://sec.ch9.ms/ch9/04c0/43b428a3-3a58-4f05-99ce-0929800004c0/azfr576_960.jpg)
The Invoke-SqlNotebook cmdlet executes a SQL Notebook file (.ipynb) and outputs the materialized notebook. In this article Syntax Invoke-Sql Notebook Executes a SQL Notebook file (.ipynb) and outputs the materialized notebook.