{"id":13596653,"url":"https://github.com/MikeShepard/SQLPSX","last_synced_at":"2025-04-09T16:33:36.222Z","repository":{"id":33648565,"uuid":"37301006","full_name":"MikeShepard/SQLPSX","owner":"MikeShepard","description":"SQL PowerShell Extensions","archived":false,"fork":false,"pushed_at":"2018-02-02T21:02:08.000Z","size":27144,"stargazers_count":94,"open_issues_count":12,"forks_count":27,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-06T19:46:28.466Z","etag":null,"topics":["adonet","powershell","smo","sqlserver"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"ms-pl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeShepard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-12T03:56:27.000Z","updated_at":"2024-10-16T19:54:27.000Z","dependencies_parsed_at":"2022-08-17T19:05:22.273Z","dependency_job_id":null,"html_url":"https://github.com/MikeShepard/SQLPSX","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeShepard%2FSQLPSX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeShepard%2FSQLPSX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeShepard%2FSQLPSX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeShepard%2FSQLPSX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeShepard","download_url":"https://codeload.github.com/MikeShepard/SQLPSX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248068047,"owners_count":21042406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adonet","powershell","smo","sqlserver"],"created_at":"2024-08-01T16:02:37.386Z","updated_at":"2025-04-09T16:33:31.209Z","avatar_url":"https://github.com/MikeShepard.png","language":"PowerShell","readme":"# SQL Server PowerShell Extensions\r\n\r\n## Getting Started with SQLPSX\r\n\r\n**NOTE: You must have SMO installed to run the SQLPSX, SMO is installed with SQL Server Management Studio**\r\n\r\n**Powershell 2.0 is required**\r\n\r\nInstaller installation: **Run SQLPSX.msi installer**\r\n\r\n### Manual installation\r\n1. Unblock zip file\r\n2. Copy all Modules to $env:psmodulepath directory and Script files to any directory. \r\n\r\n### Using Modules\r\n1. Run import-module\r\n  1. Import the master module sqlpsx (modify sqlpsx.psm1 as needed)\r\n    - import-module sqlpsx\r\n  2. Or import individual modules\r\n    - import-module SQLServer\r\n    - import-module Agent\r\n    - import-module Repl\r\n    - import-module SSIS\r\n    - import-module SQLParser\r\n    - import-module Showmbrs\r\n    - import-module adolib\r\n    - import-module sqlmaint\r\n    - import-module sqlise\r\n    - import-module oracleise\r\n  1. PBM module should be used in the sqlps mini-shell. Because import-module isn't supported in \r\n   - Microsoft's sqlps shell, source the functions:\r\n   - . ./pbm.psm1\r\n2. Add import-module commands to your Profile if desired\r\n\r\nOptional Database and Reporting Services Components\r\n\r\n1. Create a database, for example SQLPSX and run the SQLPSX.AllObject.sql script to create the all database objects\r\n2. Modify SSRS Data Source file SQLPSX.rds to point to the newly created database\r\n3. Deploy the SSRS reports and Data Source files to a SSRS Server or run locally\r\n4. Modify Run-SmoToCsvFile.ps1, Write-SmoCsvToDb.ps1 and Write-SmoToCsvFile.ps1 scripts with your parameters\r\n5. Insert the SQL Server instances you wish to report into the SqlServer table\r\n6. Run Run-SmoToCsvFile.ps1 to create csv files of all available security information\r\n7. Run Write-SmoToCsvFile.ps1 to import the csv file into the database\r\n\r\n\r\n## What's New\r\n    Version 2.3.2.1\r\n        Added MySQLLib Module\r\n        Modified adolib Module\r\n            Changed SQLBulkCopy to use System.Data.Common classes rather than SQLClient-specific classes for platform interoperability \r\n            Fixed issue in new-sqlcommand\r\n        Modified OracleClient Module\r\n            Added OracleBulkCopy\r\n        Modified SQLServer Module\r\n            Added FileListOnly to Invoke-SqlRestore function\r\n            Fixed issue in PBM module when writing to Windows Event log\r\n        Modified SSIS Module\r\n            Added ProtectionLevel parameter \r\n                The package protection level can changed/specified as part of copy process:\r\n                DontSaveSensitive, EncryptSensitiveWithUserKey, EncryptSensitiveWithPassword, EncryptAllWithPassword, EncryptAllWithUserKey,\r\n                ServerStorage\r\n    Version 2.3.1\r\n        Added PerfCounters Module\r\n        Added SQLProfiler Module\r\n        Modified SQLIse Module\r\n            Fixed issues with output formatting of multi-queries\r\n            Added SQL password encryption\r\n        Modified adolib Module\r\n            Fixed issues with SQL authentication on some functions\r\n            Added enhanced output types\r\n    Version 2.3\r\n        Added MSI-based installer\r\n        Added PBM Module\r\n            Includes tables, functions, report and sample policies. Works againts SQL 2000, 2005 or 2008 or 2008 R2.\r\n        Modified adolib module\r\n            Fixed minor issues\r\n            Added invoke-bulkcopy to which uses SqlBulkCopy class in and allows column mapping\r\n            Added new-sqlcmd which is used to create SqlCommand objects for use in other functions and invoke-bulkcopy\r\n        Modified OracleIse module\r\n            Moved saved preference to User Store instead of module directory\r\n            Modified prompt to show both Oracle and SQL Server connections\r\n            Added auto, table, list, and isetab output options\r\n            Added PoshMode which allows embedding PowerShell variables in queries\r\n            Moved output option to separate dialog box\r\n        Modified SQLIse module\r\n            Moved saved preference to User Store instead of module directory\r\n            Modified prompt to show both Oracle and SQL Server connections\r\n            Added auto, table, list, and isetab output options\r\n            Moved output option to separate dialog box\r\n            Added print and raiserror handling\r\n            Added multi-query handling\r\n        Modified SqlServer module\r\n            Fixed Write-SmoCsvToDb.ps1, Write-SmoToCsvFile.ps1 and Run-SmoToCsvFile.ps1\r\n            Changed statement timeout from the default of 10 minutes to unlimited. This was needed for backup and other long\r\n                operations. Timeout can be also be specified by user\r\n            Fixed issues/added functionality in specifying database objects\r\n            Added progress indicator, precent complete and success messages to backup and restore functions\r\n    Version 2.2.3\r\n        Fixed issues with PoshMode\r\n    Version 2.2.2\r\n        Fixed issue with installer\r\n        Changed SQLPSX module to standard module location and sub modules under sqlpsx\\modules\r\n    Version 2.2.1\r\n        Fixed issue with Show-TableBrowser not displaying\r\n        Removed connections.xml and conninfo.xml\r\n        Fixed issue with installer when Windows profile selected\r\n    Version 2.2\r\n        Modifed SQLIse module\r\n            Added table and object browser\r\n            Added PoshMode (like sqlcmdmode)\r\n            Added ability to output to variable\r\n            Added saved connection feature\r\n            Added Tab Expansion of schemas, tables, views, functions, procedures, columns and parameters.\r\n        Added OracleIse module\r\n        Added OracleClient module used by OracleIse\r\n        Included WPK and ISECreamBasic modules from PowerShellPack and ISECream projects\r\n        Added SQLPSX installer\r\n        Fixed issue with adolib new-connection using SQL authentication\r\n        Fixed issues with Add-SQLLogin and Add-SqlUser functions in SQL Server 2000\r\n        Changed Module folder structure to Modules\\SQLPSX\\Modules\r\n        Moved all scripts, source code, reports and database scripts under related module\r\n    Version 2.1\r\n        Add SQLIse module.\r\n        Minor fixes to SQLMaint module.\r\n    Version 2.02\r\n        Added SQLMaint module.\r\n        Removed Invoke-DbMaintBackup script (replaced by SQLMaint module)\r\n    Version 2.01\r\n        Modified Get-SqlDatabase function to return system databases when -force parameter is used.\r\n        Added Invoke-DbMaintBackup to scripts\r\n    Version 2.0\r\n        Converted function libraries and snapins to modules\r\n        Created comment-based help for all functions\r\n        Made helper functions private through use of module manifests (psd1 files)\r\n        Converted functions to advanced functions with parameter bindings\r\n        Refactored code to use Powershell V2 features:\r\n            try/catch\r\n            valuefrompipeline\r\n            validatescript\r\n            validateset\r\n            new-object -property hashtable\r\n            add-type\r\n        Renamed Set-SqlScriptingOptions to New-SqlScriptingOptions\r\n        Renamed Get-ReplScriptOptions to New-ReplScriptOptions\r\n        Removed scriptopts and replscriptopts text files in favor of script option objects\r\n        Moved Get-InvalidLogins.ps1 and Get-SessionTimeStamp.ps1 into SQLServer module\r\n        Removed Init-SqlParser.ps1 script (not needed since SQLParser is now a module)\r\n        Added new ADO.NET module\r\n        Added format file for SSIS packages\r\n        More rigorous testing was performed using PSUnit testing framework\r\n        Fixed issues discovered in testing\r\n        Added 5 aliases for Information_Schema and sysdatabases functions. These functions were renamed with a Get-Sql* prefix\r\n        All parameters are strongly typed where possible\r\n                        \r\n    Version 1.6\r\n        Get-SqlConnection\r\n        Maintenane Release\r\n        +Added support for SQL authentication\r\n        +Add better error handling using technique described in post by Allen White:\r\n            http://sqlblog.com/blogs/allen_white/archive/2009/06/08/handling-errors-in-powershell.aspx\r\n        +Changed all boolean value parameters to switch data type\r\n        +Added SMOVersion global variable\r\n        +Fixed issue with CopyOnly backups\r\n        +Fixed issue with role names containing the word public\r\n        +Fixed issue with Invoke-SqlRestore and relocatefiles param\r\n        +Updated SqlParser cmdlets to VSDB R2\r\n    Version 1.5\r\n        Invoke-SqlBackup (Database,Log) Invoke-SqlRestore (Database, Log) Invoke-SqlDatabaseCheck Invoke-SqlIndexRebuild Get-SqlIndexFragmentation\r\n        Invoke-SqlIndexDefrag Update-SqlStatistic Add-SqlDatabase Remove-SqlDatabase Add-SqlFileGroup Add-SqlDataFile Add-SqlLogFile Get-SqlDefaultDir\r\n        Add-SqlUser Remove-SqlUser Add-SqlLogin Remove-SqlLogin Add-SqlServerRoleMember Remove-SqlServerRoleMember Add-SqlDatabaseRole\r\n        Remove-SqlDatabaseRole Add-SqlDatabaseRoleMember Remove-SqlDatabaseRolemember Set-SqlServerPermission (GRANT, REVOKE, DENY)\r\n        Set-SqlDatabasePermission (GRANT, REVOKE, DENY) Set-SqlObjectPermission (GRANT, REVOKE, DENY) Get-SqlErrorLog Get-SqlSchema Get-SqlProcess\r\n        Get-SqlTransaction Get-SqlEdition Test-SqlScript Out-SqlScript\r\n    Version 1.4\r\n        Added the following functions:\r\n        Copy-ISItemSQLToSQL Copy-ISItemSQLToFile Copy-ISItemFileToSQL Get-ISData Get-ISItem Get-ISPackage Get-ISRunningPackage Get-ISSqlConfigurationItem\r\n        New-ISApplication New-ISItem Remove-ISItem Rename-ISItem Set-ISConnectionString Set-ISPackage Test-ISPath\r\n    Version 1.3\r\n        Added the following functions:\r\n        Get-SqlConnection Get-ReplServer Get-ReplLightPublication New-ReplTransPublication New-ReplMergePublication Get-ReplSubscriberSubscription\r\n        Get-ReplPublication Get-ReplSubscription Get-ReplArticle Get-ReplMonitor Get-ReplPublisherMonitor Get-ReplPublicationMonitor\r\n        Get-ReplEnumPublications Get-ReplEnumPublications2 Get-ReplEnumSubscriptions Get-ReplEnumSubscriptions2 Get-ReplTransPendingCommandInfo\r\n        Get-ReplEnumLogReaderAgent Get-ReplEnumSnapshotAgent Set-ReplScriptOptions Get-ReplScript\r\n    Version 1.2\r\n        Added the following functions:\r\n        Get-AgentJobServer  Get-AgentAlertCategory  Get-AgentAlert  Get-AgentJob  Get-AgentJobSchedule  Get-AgentJobStep  Get-AgentOperator\r\n        Get-AgentOperatorCategory  Get-AgentProxyAccount  Get-AgentSchedule  Get-AgentTargetServerGroup  Get-AgentTargetServer  Get-AgentJobHistory\r\n    Version 1.1\r\n        Added the following functions:\r\n        Get-SqlTable Get-SqlStoredProcedure Get-SqlView Get-SqlUserDefinedDataType Get-SqlUserDefinedFunction Get-SqlSynonym Get-SqlTrigger Get-SqlColumn\r\n        Get-SqlIndex Get-SqlStatistic Get-SqlCheck Get-SqlForeignKey Set-SqlScriptingOptions Get-SqlScripter Get-Information_Schema.Tables\r\n        Get-Information_Schema.Columns Get-Information_Schema.Views Get-Information_Schema.Routines Get-SysDatabases Get-SqlDataFile Get-SqlLogFile\r\n        Get-SqlVersion Get-SqlPort ConvertTo-ExtendedPropertyXML Get-Sql ConvertTo-StatisticColumnXML ConvertTo-IndexedColumnXML\r\n\r\n### Modules\r\n    SQLMaint Module functions\r\n        Invoke-DbMaint\r\n            Implements full database maintenance including backups, index maintenance, statistics, and backup cleanup. \r\n            Equivalent to Database Maintenance Wizard\r\n    AdoLib Module functions\r\n        New-Connection\r\n            Create a SQLConnection object with the given parameters\r\n        Invoke-Sql\r\n            Execute a sql statement, ignoring the result set. Returns the number of rows modified by the statement (or -1 if it was not a DML staement\r\n        Invoke-Query\r\n            Execute a sql statement, returning the results of the query\r\n        Invoke-StoredProcedure\r\n            Execute a stored procedure, returning the results of the query\r\n        Invoke-Bulkcopy\r\n        New-SQLCommand\r\n    SqlParser Module cmdlets\r\n        Test-SqlScript\r\n            Determines whether a SQL script is valid.\r\n        Out-SqlScript\r\n            Sends out to the host as a SQL script.\r\n    SQLServer Module functions\r\n        Get-SqlServer\r\n            Returns a Microsoft.SqlServer.Management.Smo.Server Object\r\n        Get-SqlDatabase\r\n            Returns an SMO Database object or collection of Database objects\r\n        Get-SqlData\r\n            Executes a query returns an array of System.Data.DataRow\r\n        Set-SqlData\r\n            Executes a query that does not return a result set\r\n        Get-SqlShowMbrs\r\n            Recursively enumerates AD/local groups handling built-in SQL Server Windows groups\r\n        Get-SqlUser\r\n            Returns a SMO User object with additional properties including all of the objects owned by the user\r\n            and the effective members of the user. Recursively enumerates nested AD/local groups\r\n        Get-SqlDatabaseRole\r\n            Returns a SMO DatabaseRole object with additional properties including the effective members of a\r\n            role recursively enumerates nested roles, and users\r\n        Get-SqlLogin\r\n            Returns a SMO Login object with additional properties including the effective members of the login\r\n        Get-SqlLinkedServerLogin\r\n            Returns a SMO LinkedServerLogin object with additional properties including LinkedServer and DataSource\r\n        Get-SqlServerRole\r\n            Returns a SMO ServerRole object with additional properties including the effective members of a role.\r\n            Recursively enumerates nested AD/local groups\r\n        Get-SqlServerPermission\r\n            Returns a SMO ServerPermission object with additional properties including the effective members of a\r\n            grantee. Recursively enumeates nested roles and logins\r\n        Get-SqlDatabasePermission\r\n            Returns a SMO DatabasePermission object with additional properites including the effective members of a\r\n            grantee. Recursively enumerates nested roles and users\r\n        Get-SqlObjectPermission\r\n            Returns a SMO ObjectPermission object with additional properties including the effective members of a\r\n            grantee. Recursively enumerates nested roles and users\r\n        Get-SqlTable\r\n            Returns a SMO Table object with additional properties\r\n        Get-SqlStoredProcedure\r\n            Returns a SMO StoredProcedure object with additional properties\r\n        Get-SqlView\r\n            Returns a SMO View object with additional properties\r\n        Get-SqlUserDefinedDataType\r\n            Returns a SMO UserDefinedDataType object with additional properites\r\n        Get-SqlUserDefinedFunction\r\n            Returns a SMO UserDefinedFunction object with additional properites\r\n        Get-SqlSynonym\r\n            Returns a SMO Synonym object with additional properites\r\n        Get-SqlTrigger\r\n            Returns a SMO Trigger object with additional properites. Note: A Trigger can have a Server, Database or Table/View parent object.\r\n        Get-SqlColumn\r\n            Returns a SMO Column object with additional properites. Note: A Column can have either a Table or View parent object.\r\n        Get-SqlIndex\r\n            Returns a SMO Index object with additional properites. Note: An Index can have either a Table or View parent object.\r\n        Get-SqlStatistic\r\n            Returns a SMO Statistic object with additional properites\r\n        Get-SqlCheck\r\n            Returns a SMO Check object with additional properites. Note: A Check can have either a Table or View parent object.\r\n        Get-SqlForeignKey\r\n            Returns a SMO ForeignKey object with additional properites\r\n        New-SqlScriptingOptions\r\n            Sets scripting option used in Get-SqlScripter function by reading in the text file scriptopts.txt\r\n        Get-SqlScripter\r\n            Returns a SMO Scripter object. Any function which returns a SMO object can pipe to Get-SqlScripter. For example to script out all table\r\n            in the pubs database: Get-SqlDatabase MyServer | Get-SqlTable | Get-SqlScripter\r\n        Get-SqlInformation_Schema.Tables\r\n            Returns the result set from INFORMATION_SCHEMA.Tables for the specified database(s) along with the Server name\r\n        Get-SqlInformation_Schema.Columns\r\n            Returns the result set from INFORMATION_SCHEMA.Columns for the specified database(s) along with the Server name\r\n        Get-SqlInformation_Schema.Views\r\n            Returns the result set from INFORMATION_SCHEMA.Views for the specified database(s) along with the Server name\r\n        Get-SqlInformation_Schema.Routines\r\n            Returns the result set from INFORMATION_SCHEMA.Routines for the specified database(s) along with the Server name\r\n        Get-SqlSysDatabases\r\n            Returns the result set from sysdatases for the specified server along with the Server name\r\n        Get-SqlDataFile\r\n            Returns a SMO DataFile object with additional properties\r\n        Get-SqlLogFile\r\n            Returns a SMO LogFile object with additional properties\r\n        Get-SqlVersion\r\n            Returns a custom object with the Server name and version number\r\n        Get-SqlPort\r\n            Uses SQL-DMO to return the port number of the specified SQL Server\r\n        Get-Sql\r\n            Uses WMI to list all of the SQL Server related services running on the specified computer along with the service state and service account\r\n        Invoke-SqlBackup (Database,Log)\r\n            Performs a SQL Backup\r\n        Invoke-SqlRestore (Database, Log)\r\n            Performs a SQL Restore\r\n        Invoke-SqlDatabaseCheck\r\n            Performs the equivalent of a DBCC CHECKDB\r\n        Invoke-SqlIndexRebuild\r\n            Performs a reindex \r\n        Get-SqlIndexFragmentation\r\n            Returns index fragmentation similar to DBCC SHOWCONTIG\r\n        Invoke-SqlIndexDefrag\r\n            Defragments an index. Performs the equivalent of a DBCC INDEXDEFRAG\r\n        Update-SqlStatistic\r\n            Updates statistics\r\n        Add-SqlDatabase\r\n            Adds a new database to a SQL Server\r\n        Remove-SqlDatabase\r\n            Removes a database from a SQL Server\r\n        Add-SqlFileGroup\r\n            Adds a new filegroup to a database\r\n        Add-SqlDataFile\r\n            Adds a new datafile to a filegroup\r\n        Add-SqlLogFile\r\n            Adds a new logfile to a database\r\n        Get-SqlDefaultDir\r\n           Returns the default location for data and log files for a SQL Server \r\n        Add-SqlUser\r\n            Adds a new user to a database\r\n        Remove-SqlUser\r\n            Removes a user from a database\r\n        Add-SqlLogin\r\n            Adds a login to a SQL Server\r\n        Remove-SqlLogin\r\n            Removes a login from a SQL Server\r\n        Add-SqlServerRoleMember\r\n            Adds a login to a server role\r\n        Remove-SqlServerRoleMember\r\n            Removes a login from a server role\r\n        Add-SqlDatabaseRole\r\n            Adds a new database role to a database\r\n        Remove-SqlDatabaseRole\r\n            Removes a database roel from a database\r\n        Add-SqlDatabaseRoleMember\r\n            Adds a user or role to a database role\r\n        Remove-SqlDatabaseRolemember\r\n            Removes a user or role from a database role\r\n        Set-SqlServerPermission (GRANT, REVOKE, DENY)\r\n            Sets server level permissions to a login\r\n        Set-SqlDatabasePermission (GRANT, REVOKE, DENY)\r\n            Sets database level permissiosn to a user or role\r\n        Set-SqlObjectPermission (GRANT, REVOKE, DENY)\r\n            Sets database object level permissions to a user or role\r\n        Get-SqlErrorLog\r\n            Returns the SQL Server Errorlog\r\n        Get-SqlSchema\r\n            Returns a SMO Schema object with additional properties\r\n        Get-SqlProcess\r\n            Returns the current proccesses on a SQL Server. Equivalent to sp_who\r\n        Get-SqlTransaction\r\n            Returns the current open transactions for a database\r\n        Get-SqlEdition\r\n            Returns the SQL Server edition\r\n    Agent Module functions\r\n        Get-AgentJobServer\r\n            Returns a Microsoft.SqlServer.Management.Smo.Agent.JobServer Object. This is the top level object for Agent.Smo\r\n        Get-AgentAlertCategory\r\n            Returns an SMO.Agent AlertCategory object or collection of AlertCategory objects\r\n        Get-AgentAlert\r\n            Returns an SMO.Agent Alert object or collection of Alert objects\r\n        Get-AgentJob\r\n            Returns an SMO.Agent Job object or collection of Job objects\r\n        Get-AgentJobSchedule\r\n            Returns an SMO.Agent JobSchedule object or collection of JobSchedule objects for Job Objects\r\n        Get-AgentJobStep\r\n            Returns an SMO.Agent JobStep object or collection of JobStep objects\r\n        Get-AgentOperator\r\n            Returns an SMO.Agent Operator object or collection of Operator objects\r\n        Get-AgentOperatorCategory\r\n            Returns an SMO.Agent OperatorCategory object or collection of OperatorCategory objects\r\n        Get-AgentProxyAccount\r\n            Returns an SMO.Agent ProxyAccount object or collection of ProxyAccount objects\r\n        Get-AgentSchedule\r\n            Returns an SMO.Agent JobSchedule object or collection of JobSchedule objects for JobServer Shared Schedules\r\n        Get-AgentTargetServerGroup\r\n            Returns an SMO.Agent TargetServerGroup object or collection of TargetServerGroup objects\r\n        Get-AgentTargetServer\r\n            Returns an SMO.Agent TargetServer object or collection of TargetServer objects\r\n        Set-AgentJobHistoryFilter\r\n            Sets filtering option used in Get-AgentJobHistory function\r\n        Get-AgentJobHistory\r\n            Returns an array of System.Data.DataRow of job history, filtering can be applied by using the Set-AgentJobHistoryFilter function\r\n    Repl Module functions\r\n        Get-SqlConnection\r\n            Returns a ServerConnection object\r\n        Get-ReplServer\r\n            Returns an RMO.ReplicationServer\r\n        Get-ReplLightPublication\r\n            Returns an RMO.LightPublication\r\n        New-ReplTransPublication\r\n            Constructor for RMO.TransPublication\r\n        New-ReplMergePublication\r\n            Constructor for RMO.MergePublication\r\n        Get-ReplSubscriberSubscription\r\n            Returns an RMO.SubscriberSubscription. Note: this is the only function executed on a subscriber\r\n        Get-ReplPublication\r\n            Returns either an RMO.TransPublication or RMO.MergePublication object\r\n        Get-ReplSubscription\r\n            Returns an RMO.TransSubscription or RMO.MergeSubscription object from a Publication\r\n        Get-ReplArticle\r\n            Returns an RMO.TransArticle or RMO.MergeArticle object from a Publication\r\n        Get-ReplMonitor\r\n            Returns an RMO.ReplicationMonitor\r\n        Get-ReplPublisherMonitor\r\n            Returns an RMO.PublisherMonitor\r\n        Get-ReplPublicationMonitor\r\n            Returns an RMO.PublicationMonitor\r\n        Get-ReplEnumPublications\r\n            Calls the EnumPublications method on a PublisherMonitor object\r\n        Get-ReplEnumPublications2\r\n            Calls the EnumPublications method on a PublisherMonitor object\r\n        Get-ReplEnumSubscriptions\r\n            Calls the EnumSubscriptions method on a PublicationMonitor object\r\n        Get-ReplEnumSubscriptions2\r\n            Calls the EnumSubscriptions2 method on a PublicationMonitor object\r\n        Get-ReplTransPendingCommandInfo\r\n            Calls the TransPendingCommandInfo method on a PublicationMonitor object\r\n        Get-ReplEnumLogReaderAgent\r\n            Calls the EnumLogReaderReader method on a PublicationMonitor object\r\n        Get-ReplEnumSnapshotAgent\r\n            Calls the EnumSnapshotAgent method on a PublicationMonitor object\r\n        New-ReplScriptOptions\r\n            Sets the Enum ScriptOptions for scripting RMO objects. Unlike SMO which has a default script options\r\n            RMO at at a minimum CREATION enum must be specified.\r\n        Get-ReplScript\r\n            Calls Script Method on RMO objects include ReplicationServer, Publication, Subscription and Articles\r\n    SSIS Module functions:\r\n        Copy-ISItemSQLToSQL\r\n            Copies a Package or SSIS folder from SQL to SQL\r\n        Copy-ISItemSQLToFile\r\n            Copies a Package or SSIS folder from SQL to file\r\n        Copy-ISItemFileToSQL\r\n            Copies a Package or SSIS folder from file to SQL\r\n        Get-ISData\r\n            Executes a query and returns an array of System.Data.DataRow\r\n        Get-ISItem\r\n            Retrieves a list of SQL Server Integration Services folders and packages from the specified SQL Server instance. Returns a PackInfo Object.\r\n            Note: Unlike the other SSIS functions this function requires a SQL instance name i.e. serverName\\instanceName\r\n        Get-ISPackage\r\n            Retrieves an SSIS package from the specified Integration Services server or file path. Returns a Package Object\r\n        Get-ISRunningPackage\r\n            Returns a list of running packages on the specified Integration Services server. Returns a RunningPackage object or collection of objects\r\n        Get-ISSqlConfigurationItem\r\n            Executes a query to retrieve a configuration item\r\n        New-ISApplication\r\n            Base object for all other functions. Executes new-object (\"Microsoft.SqlServer.Dts.Runtime.Application\") \r\n        New-ISItem\r\n            Creates a SQL storage folder for the specified Integration Services server\r\n        Remove-ISItem\r\n            Deletes a SQL storage folder or package on the specified Integration Services server\r\n        Rename-ISItem\r\n            Renames a SQL storage folder or package on the specified Integration Services server\r\n        Set-ISConnectionString\r\n            Sets the Connection string for an SSIS package. Useful for package configuration connection string which cannot be set dynamically at run \r\n            or deploy time\r\n        Set-ISPackage\r\n            Saves an SSIS package to an Integration Services server or file path as a dtsx file.\r\n        Test-ISPath\r\n            Test the existance of a SQL storage folder or package on the specified Integration Services server\r\n    LibraryShowmbrs.ps1 functions\r\n        Get-ShowMbrs\r\n            Recursivley enumerates local Windows and AD groups similar to the NT Resource utility showmbrs.exe\r\n    PBM Module functions:\r\n        Get-PolicyStore\r\n            Gets a Policy Server i.e. server where policies are stored\r\n        Write-PolicyEvalError\r\n            Write the errors messages from a Policy evaluation to the policy evaluation database\r\n        Write-PolicyEval\r\n            Writes the results of a policy evaluation to the policy evaluation sdatabase\r\n        Import-PolicyEvaluation\r\n            Evaluates a set of policies based on a policy category and CMS groupusing invoke-policyevaluation cmdlet. The results and error messages\r\n            if any are written to policy evaluation database. Optionally writes a event log entry (useful for integrating with SCOM).\r\n    OracleClient Module functions:\r\n        ConvertTo-oracleDataSource\r\n        invoke-oracle_query\r\n        Invoke-OracleBulkcopy\r\n        New-Oracle_connection\r\n   MySQLLib Module functions:\r\n        Invoke-MySql\r\n        Invoke-MySQLQuery\r\n        Invoke-MySQLStoredProcedure\r\n        New-MySQLCommand\r\n        New-MySQLConnection\r\n        \r\n### Scripts\r\n    Get-InvalidLogins.ps1\r\n        Lists invalid AD/NT logins/groups which have been granted access to the\r\n        specified SQL Server instance. Script calls the system stored procedure\r\n        sp_validatelogins and validates the output by attempting to resolve the sid\r\n        against AD. The second level of validation is done because sp_validatelogins\r\n        incorrectly reports logins/groups which have been renamed in AD. SQL Server\r\n        stores the AD sid so renamed accounts still have access to the instance.\r\n        Renamed logins/groups are listed with the renamed value in the newAccount\r\n        property.\r\n    Get-SessionTimeStamp.ps1\r\n        Creates a global session timestamp\r\n    Run-SmoToCsvFile.ps1\r\n        Runs Write-SmoToCsvFile.ps1 with the specified number of threads.\r\n    Test-SqlConn.ps1\r\n        Verifies Sql connectivity and writes successful connection to stdout and\r\n        failed connections to stderr. Script is useful when combined with other\r\n        scripts which would otherwise produce a terminating error on connectivity\r\n    Write-SmoCsvToDb.ps1\r\n        Load the SMO Csv file into the specified database\r\n    Write-SmoToCsvFile.ps1\r\n        Generates an a csv file for all SQL Server security settings\r\n    Invoke-DbMaintBackup.ps1\r\n        Backs up all user, system or both user and system database, logs, or files. Includes logging and cleanup routines. See get-help \r\n        invoke-DbMaintBackup.ps1 for details.\r\n    formatsql.bat\r\n        Simple bat file for calling powershell.exe with the command set to out-sqlscript\r\n\r\n### SQL Server Reporting Services (2008) reports\r\n    See the screenshots_sqlpsx.docx for sample output of reports\r\n\r\n    SQLPSXChangedDatabasePermission.rdl\r\n    SQLPSXChangedDatabaseRole.rdl\r\n    SQLPSXChangedLogin.rdl\r\n    SQLPSXChangedObjectPermission.rdl\r\n    SQLPSXChangedServerPermission.rdl\r\n    SQLPSXChangedServerRole.rdl\r\n    SQLPSXChangedSqlUser.rdl\r\n    SQLPSXChangedSqlUserOwnedObject.rdl\r\n    SQLPSXDatabasePermission.rdl\r\n    SQLPSXDatabaseRole.rdl\r\n    SQLPSXLinkedServerLogin.rdl\r\n    SQLPSXLogin.rdl\r\n    SQLPSXLoginGrouped.rdl\r\n    SQLPSXObjectPermission.rdl\r\n    SQLPSXServerPermission.rdl\r\n    SQLPSXServerRole.rdl\r\n    SQLPSXSqlUser.rdl\r\n    SQLPSXSqlUserGrouped.rdl\r\n    SQLPSXSqlUserOwnedObject.rdl\r\n\r\n### Global Variables\r\n    The following global session variables are used to cache information used across functions\r\n\r\n    $__SQLPSXUserMember\r\n    $__SQLPSXDatabaseRoleMember\r\n    $__SQLPSXLoginMember\r\n    $__SQLPSXGroupUser\r\n    $__SQLPSXIsDomain\r\n    $__SQLPSXInvalidLogin\r\n    $__SQLPSXSessionTimeStamp\r\n\r\n### SQLPSX Database\r\n    SQLPSX.AllObject.sql\r\n        Single script for all database objects\r\n    SQLPSX.Job.sql\r\n        SQL Agent job to schedule running of Run-SmoToCsvFile.ps1 and importing into database using Write-SmoCsvToDb.ps1\r\n","funding_links":[],"categories":["PowerShell","PowerShell and SQL Server"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeShepard%2FSQLPSX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMikeShepard%2FSQLPSX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeShepard%2FSQLPSX/lists"}