PowerShell: Manipulating & Copying File Permissions In Windows

The Mystery Recently a folder within a SMB share on the Windows Server (network share) displayed only certain files but not others for a certain user. For an administrator, the share displayed all the files in the folder. Obviously, there is some difference in the permissions, but what? Examining the difference between the files (using … Continue reading PowerShell: Manipulating & Copying File Permissions In Windows

SQL Server: Quick Space & File Layout Analysis With PowerShell and PowerBI

Long time ago, I created a little chunk of TSQL to get a glimpse of my space and file layout information at the Database/File/Filegroup level. It is a basic routine that spins through all the databases of an instance to collect space usage data. Over the years, I have used it a lot and it … Continue reading SQL Server: Quick Space & File Layout Analysis With PowerShell and PowerBI

SQL Server: Run A Very Large Script By Splitting It Into Pieces Using PowerShell

Everyday is an interesting day in the life of a DBA. Today, I received a request to run in a HUGE script. This script had 125k INSERT statements each in a separate line. Just opening the script was an issue, leave alone running it into a database. You get this error in SSMS just trying … Continue reading SQL Server: Run A Very Large Script By Splitting It Into Pieces Using PowerShell

PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria

Update April 19, 2019: Thanks to Tim (in comments), the updated script can also do find/replace in not just stored procedures but also views, UDF's and triggers. Today, a need came-up where a bunch of stored procedures had to be altered based on certain criteria. Easy way: Obviously, the easiest way would be to script … Continue reading PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria