-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed most Read-Host lines with script parameters
- Loading branch information
Jesse Russell
committed
Nov 26, 2018
1 parent
30aa303
commit e3a36ec
Showing
22 changed files
with
101 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
# Install-Module InvokeQuery | ||
# Run the above command if you do not have this module | ||
param( | ||
$server, | ||
$database, | ||
$dbuser, | ||
$dbpass, | ||
$query | ||
) | ||
$csvfilepath = "$PSScriptRoot\mysql_table.csv" | ||
Do { | ||
$server = Read-Host "Please enter the server host name or IP of the database" | ||
} | ||
While ($server -eq "") | ||
Do { | ||
$database = Read-Host "Please enter the database name" | ||
} | ||
While ($database -eq "") | ||
Do { | ||
$dbuser = Read-Host "Please enter the database user" | ||
} | ||
While ($dbuser -eq "") | ||
Do { | ||
$dbpass = Read-Host "Please enter the database user's password" | ||
} | ||
While ($dbpass -eq "") | ||
Do { | ||
$query = Read-Host "Please enter the sql query" | ||
} | ||
While ($query -eq "") | ||
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$dbuser; password=$dbpass; pooling = false; convert zero datetime=True" -Sql $query -CommandTimeout 10000 | ||
$result | Export-Csv $csvfilepath -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
# Install-Module InvokeQuery | ||
# Run the above command if you do not have this module | ||
param($server,$database,$query,$username,$password) | ||
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force | ||
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd) | ||
$csvfilepath = "$PSScriptRoot\sqlserver_table.csv" | ||
Do { | ||
$server = Read-Host "Please enter the server host name or IP of the database" | ||
} | ||
While ($server -eq "") | ||
Do { | ||
$database = Read-Host "Please enter the database name" | ||
} | ||
While ($database -eq "") | ||
Do { | ||
$query = Read-Host "Please enter the sql query" | ||
} | ||
While ($query -eq "") | ||
$result = Invoke-SqlServerQuery -Credential (Get-Credential) -ConnectionTimeout 10000 -Database $database -Server $server -Sql $query -CommandTimeout 10000 | ||
$result = Invoke-SqlServerQuery -Credential $creds -ConnectionTimeout 10000 -Database $database -Server $server -Sql $query -CommandTimeout 10000 | ||
$result | Export-Csv $csvfilepath -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
# This script is super simple, it just creates a symbolic link. | ||
# It repuires the code module, so if you don't have it you can install it with: | ||
# Install-Module core | ||
# Grab input | ||
Do { | ||
$linkpath = Read-Host "Please enter the path of the symbolic link" | ||
} | ||
While ($linkpath -eq "") | ||
Do { | ||
$target = Read-Host "Please enter the path of the target" | ||
} | ||
While ($target -eq "") | ||
param( | ||
$linkpath, | ||
$target | ||
) | ||
# Create the link | ||
New-SymLink -Link $linkpath -Target $target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
# This script lists all of the tables in a MySQL database and exports the list as a CSV | ||
# Install-Module InvokeQuery | ||
# Run the above command if you do not have this module | ||
param($server,$database,$dbuser,$dbpass) | ||
$csvfilepath = "$PSScriptRoot\mysql_tables.csv" | ||
Do { | ||
$server = Read-Host "Please enter the server host name or IP of the database" | ||
} | ||
While ($server -eq "") | ||
Do { | ||
$database = Read-Host "Please enter the database name" | ||
} | ||
While ($database -eq "") | ||
Do { | ||
$dbuser = Read-Host "Please enter the database user" | ||
} | ||
While ($dbuser -eq "") | ||
Do { | ||
$dbpass = Read-Host "Please enter the database user's password" | ||
} | ||
While ($dbpass -eq "") | ||
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$dbuser; password=$dbpass; pooling = false; convert zero datetime=True" -Sql "SHOW TABLES" -CommandTimeout 10000 | ||
$result | Export-Csv $csvfilepath -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
# This script lists all of the tables in a SQL Server database and exports the list as a CSV | ||
# Install-Module InvokeQuery | ||
# Run the above command if you do not have this module | ||
param($server,$database,$username,$password) | ||
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force | ||
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd) | ||
$csvfilepath = "$PSScriptRoot\sqlserver_tables.csv" | ||
Do { | ||
$server = Read-Host "Please enter the server host name or IP of the database" | ||
} | ||
While ($server -eq "") | ||
Do { | ||
$database = Read-Host "Please enter the database name" | ||
} | ||
While ($database -eq "") | ||
$result = Invoke-SqlServerQuery -Credential (Get-Credential) -ConnectionTimeout 10000 -Database $database -Server $server -Sql "SELECT TABLE_NAME FROM $database.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'" -CommandTimeout 10000 | ||
$result = Invoke-SqlServerQuery -Credential $creds -ConnectionTimeout 10000 -Database $database -Server $server -Sql "SELECT TABLE_NAME FROM $database.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'" -CommandTimeout 10000 | ||
$result | Export-Csv $csvfilepath -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# This script pings a server or IP every interval. This is useful for servers that "go to sleep" (for lack of a better term) when they aren't receiving any activity. | ||
$server = "" # Specify the server name or IP | ||
$interval = 30 # You can change the interval, by default set as 30 seconds | ||
param( | ||
$server, | ||
$intervalSeconds | ||
) | ||
while (1) { | ||
ping $server | ||
Start-Sleep -Seconds $interval | ||
Start-Sleep -Seconds $intervalSeconds | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.