This file contains hidden or 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
| [CmdletBinding(DefaultParameterSetName = 'GetList')] | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$DbInstance | |
| , | |
| [Parameter(Mandatory = $true)] | |
| [string]$DbCatalog | |
| , | |
| [Parameter(Mandatory = $false)] | |
| [string]$Tenant = '%' #if a tenant is not specified, this will pull back all report defintions from the db |
This file contains hidden or 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
| function Get-WhoIs { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
| [string]$Domain | |
| <# Not Yet Supported ... | |
| , | |
| [Parameter(Mandatory = $false)] | |
| [switch]$v | |
| , |
This file contains hidden or 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
| $xml1 = [xml]'<a><b id="3"><c>hello</c></b><b id="4"><c>world</c></b></a>' | |
| $xml1.SelectNodes('/a/b') | %{ | |
| $xml2 = New-Object 'System.Xml.XmlDocument' | |
| $root = $xml2.CreateElement("a") | |
| $xml2.AppendChild($root) | out-null | |
| $newNode = $xml2.ImportNode($_, $true) | |
| $root.AppendChild($newNode) | out-null | |
| $xml2.Save("c:\temp\bar_$($newNode.Attributes.GetNamedItem('id').Value).xml") | |
| } |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <crystal-report-statements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="crystal-report-statements.xsd"> | |
| <crystal-statement name="REPPRINTED_STRETF"> | |
| <sql-command IsUnique="0">UPDATE R5TRANSACTIONS SET TRA_PRINTED = N'+' | |
| where TRA_code = :cCode1 | |
| and TRA_RSTATUS = N'R'</sql-command> | |
| <sql-parameter id="1">:cCode1</sql-parameter> | |
| </crystal-statement> | |
| <crystal-statement name="REPPRINTED_STRCVF"> | |
| <sql-command IsUnique="0">UPDATE R5TRANSACTIONS SET TRA_PRINTED = N'+' |
This file contains hidden or 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
| declare @tableName sysname = 'ImageLibrary' | |
| , @GroupByColumns nvarchar(max) = 'PictureType' --comma separated list | |
| , @sql nvarchar(max) | |
| select @sql = coalesce(@sql + ', ', 'select ' + coalesce(nullif(@GroupByColumns,'') + ', ','') + 'count(1) cnt, ' ) | |
| + char(10) + 'case when max(' + quotename(name) + ') is null then 0 else 1 end ' + quotename(name) | |
| from sys.columns | |
| where object_id = object_id(@tableName) | |
| set @sql = @sql | |
| + char(10) + 'from ' + quotename(@tableName) | |
| + coalesce(char(10) + 'group by ' + nullif(@GroupByColumns,'') + '','') |
This file contains hidden or 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
| Clear-Host | |
| function Invoke-SQLQuery { | |
| [CmdletBinding(DefaultParameterSetName = 'ByQuery')] | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$DbInstance | |
| , | |
| [Parameter(Mandatory = $true)] | |
| [string]$DbCatalog |
This file contains hidden or 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
| declare @sp_who2 table | |
| ( | |
| spid int | |
| , [status] nvarchar(1000) null | |
| , [login] sysname null | |
| , hostname sysname null | |
| , blkby sysname null | |
| , dbname sysname null | |
| , command nvarchar(1000) null |
This file contains hidden or 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
| function Parse-FileZillaLogs { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [string]$Path | |
| , | |
| [Parameter()] | |
| [string]$Filter = '*.log' | |
| ) | |
| begin { |
This file contains hidden or 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
| #should just work... unless it doesn't... | |
| function Get-FormsAuthSession { | |
| [CmdletBinding()] | |
| param ( | |
| $url = 'http://example.com' | |
| ,$usernameFieldName = 'txtUsername' | |
| ,$passwordFieldName = 'txtPassword' | |
| ,$cred = (Get-Credential) | |
| ) |