Questions tagged [powershell]
Windows PowerShell™ is a task-based command-line shell and scripting language designed especially for automation of Windows tasks. Questions using this tag should restrict themselves to interactions directly with the database tier. General PowerShell scripting questions should be directed to [StackOverflow](https://stackoverflow.com/questions/tagged/powershell).
386
questions
0
votes
1
answer
37
views
sql server client network utility - how to list the aliases?
there is something called sql server client network utility
it lives on
C:\Windows\System32 for 64 bits.
as you can see I have many aliases there, server, instance and ip address and port used for ...
2
votes
1
answer
75
views
how to set in-transit encryption sql server?
today I had to check if in-transit Encryption was up and running in a particular server (sql server) and if not then set it up.
the way it is done is:
In SQL Server Configuration Manager, expand SQL ...
0
votes
1
answer
65
views
SQL Agent Job failing after uninstall of SQLPS and install of the new module
Uninstalled the old PS module and replaced it with the new SQLServer but now third step of system job syspolicy_purge_history, which is a Powershell step, fails with the following message:
The error ...
0
votes
1
answer
37
views
Invoke-PolicyEvaluation with the new SqlServer module generates security error
Started getting error messages after uninstall of PS and install of the new module SqlServer when evaluating policies on remote servers using Registered Servers and Invoke-PolicyEvaluation cmdlet. It ...
0
votes
0
answers
31
views
Write-DbaDbTableData - "Exception occurred while trying to enumerate the collection" error
I have the following code that I use to retrieve some TempDB space details on an AG:
$DataDriveTable = Invoke-DbaQuery -SqlInstance $SQLInstance -Database TempDB -Query $SelectDriveQuery -...
1
vote
1
answer
217
views
Insert values in PowerShell Variable into Oracle Database Table
I have created a script in PowerShell (utilising the PowerShell dbaTools) which collect information about SQ Server Estate in our environment. I need to insert the result from the PowerShell directly ...
0
votes
0
answers
118
views
Uninstalling a SQL Server instance using dbatools
I don't know if this is the right forum for this question, please let me know if it isn't and kindly point me in the right direction. I have just started learning powershell and dbatools.
I am trying ...
0
votes
2
answers
102
views
Error when scripting SQL View dbo.spt_values
I am using a Powershell script to generate scripts of my SQL database objects (Tables, Views, StoredProcedures etc.). It was working fine in testing and still works on 2 out of the 3 servers being ...
0
votes
0
answers
28
views
Problems with minutes in timestamps when inserting data into InfluxDB via PowerShell
I am working with InfluxDB and trying to insert time series data via PowerShell. My goal is to insert data points with specific timestamps containing hours, minutes and seconds into InfluxDB. I am ...
-1
votes
1
answer
36
views
Backup and Restore Disaster Recovery
I am using PowerShell to write a script for DR, assuming that we only have backup files of all the databases. If i have a latest sql server version and i want to restore some database from backup ...
0
votes
1
answer
281
views
How to export as a pipe-delimited file using PowerShell?
This code creates a comma-separated file, I need to convert that to the pipe-delimited format. How to do that?
$DataSet.Tables[0] | Export-csv "G:\Text.txt" -NoTypeInformation
0
votes
0
answers
39
views
Unix Powershell script stops after running SQLPlus command within the script
We are trying to create a Unix Powershell (not shell script) script which first runs a SQL to update a couple of tables, psprcsque and psprcsrqst. The function which runs the SQL update gets variables ...
1
vote
1
answer
180
views
Download certificate from Key Vault w/ private key for use in SQL Server (TDE) via powershell
I need to download an x509 Certificate from Azure Key Vault and import it in SQL Server to use for TDE.
Note: I'm not referring to EKM providers/ASYMMETRIC KEYs, where SQL accesses key vault to pull ...
0
votes
0
answers
192
views
Use PowerShell script to backup SQL Server 2019 Express database to a network destination
I've got a SQL database server (SQL Server 2019 Express) and a application server connected by a simple switch. Now I'd like to back up a SQL database to the application server.
Since its an SQL ...
0
votes
1
answer
487
views
Error with dbatools
Trying to export SQL Objects via DBAtools in Powershell.
Get-DbaAgentJob -SqlInstance 'TestServer01' -Job 'mydatabase-daily-backup' | Export-DbaScript -FilePath C:\temp\mydatabase-daily-backup.sql
...