To change your execution policy, type:
Set-ExecutionPolicy -ExecutionPolicy <PolicyName>
For example:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Use case scenario:
As a DBA you need to routinely check databases in your SQLServer, name, size, and spaceavailable, indexspaceusage. Enter the following in powershell
Set-ExecutionPolicy -ExecutionPolicy <PolicyName>
For example:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Use case scenario:
As a DBA you need to routinely check databases in your SQLServer, name, size, and spaceavailable, indexspaceusage. Enter the following in powershell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
import-module sqlps -DisableNameChecking
Set-Location SQLSERVER:\SQL\GBI-7696M12\DEFAULT\DATABASES
Get-ChildItem | SELECT NAME, SIZE, SPACEAVAILABLE, INDEXSPACEUSAGE | Out-FILE 'C:\Users\petera\Documents\DB_SCRIPT\database3.txt'
notepad 'C:\Users\petera\Documents\DB_SCRIPT\database3.txt'
Windows Client
import-module sqlps -DisableNameChecking
Set-Location SQLSERVER:\SQL\GBI-7696M12\DEFAULT\DATABASES
Get-ChildItem | SELECT NAME, SIZE, SPACEAVAILABLE, INDEXSPACEUSAGE | Out-FILE 'C:\Users\petera\Documents\DB_SCRIPT\database3.txt'
notepad 'C:\Users\petera\Documents\DB_SCRIPT\database3.txt'
Windows Client
No comments:
Post a Comment