Skip to content

Commit

Permalink
Updated read [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
RamblingCookieMonster committed Sep 13, 2016
1 parent a66ba0b commit 4653b5e
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
PowerShell
==========
# PowerShell

Various PowerShell functions and scripts
Various PowerShell functions and scripts. These are published as [WFTools](https://www.powershellgallery.com/packages/WFTools/0.1.39) on the PowerShell Gallery (thanks to @psrdrgz for the idea!)

# Instructions
## Instructions

These files contain functions. For example, Invoke-Sqlcmd2.ps1 contains the Invoke-Sqlcmd2 function.

#Download and unblock the file(s).
#Dot source the file(s) as appropriate.
```powershell
# PowerShell 5, or PackageManagement available?
Install-Module WFTools -Force
Import-Module WFTools
Get-Command -Module WFTools
Get-Help ConvertTo-FlatObject -Full
# Alternatively:
# Download and unblock the file(s).
# Dot source the file(s) as appropriate.
. "\\Path\To\Invoke-Sqlcmd2"
#Use the functions
# Use the functions
Get-Help Invoke-Sqlcmd2 -Full
Invoke-Sqlcmd2 -ServerInstance MyServer\MyInstance -Query "SELECT ServerName, VCNumCPU FROM tblServerInfo" -As PSObject -Credential $cred | ?{$_.VCNumCPU -gt 8}

# Invoke-Sqlcmd2
```

Note: Using Import-Module to load these functions will break certain scenarios for Invoke-Parallel's variable import ([details](https://github.com/RamblingCookieMonster/Invoke-Parallel/issues/16#issuecomment-77167598)) - dot source the function if you need this.

## Invoke-Sqlcmd2

I'm a fan of Invoke-Sqlcmd2. Props to Chad Miller and the other contributors for a fantastic function. I've added a few features with much help from others:

Expand All @@ -35,25 +45,25 @@ I'm a fan of Invoke-Sqlcmd2. Props to Chad Miller and the other contributors fo
* Speed comparison between DataRow and PSObject output with 1854 rows, 84 columns:
* ![Speed PSObject v Datarow](/Images/ISCPSObjectVsDatarow.png)

#### That DBNull behavior is strange! Why doesn't it behave as expected?
### That DBNull behavior is strange! Why doesn't it behave as expected?

I agree. PowerShell does a lot of work under the covers to provide behavior a non-developer might expect. From my perspective, PowerShell should handle [System.DBNull]::Value like it does Null. Please vote up [this Microsoft Connect suggestion](https://connect.microsoft.com/PowerShell/feedback/details/830412/provide-expected-comparison-handling-for-dbnull) if you agree!

Major thanks to [Dave Wyatt](http://powershell.org/wp/forums/topic/dealing-with-dbnull/) for providing the C# code that produces the PSObject output type as a workaround for this.

#### You clearly don't know SQL. Why are you working on this function?
### You clearly don't know SQL. Why are you working on this function?

I absolutely do not know SQL. If I'm doing something wrong please let me know!

I have a number of projects at work that involve PowerShell wrappers for SQL queries. Invoke-Sqlcmd2 has been my go-to command for this - now that I'm spending more time with it, I plan to add some functionality.

#### Why is Invoke-Sqlcmd2 here?
### Why is Invoke-Sqlcmd2 here?

I copied the code here to avoid the automated tweets for Poshcode.org submissions. I make many small changes and didn't want to spam twitter : )

# TechNet Galleries Contributions
## TechNet Galleries Contributions

I've copied and will continue to update my TechNet gallery contributions within this repository.
Many of these functions started out in the Technet Gallery. You might find more context at these links.

* [ConvertFrom-SID](http://gallery.technet.microsoft.com/ConvertFrom-SID-Map-SID-to-dcb354d9)
* [Get-ADGroupMembers](http://gallery.technet.microsoft.com/Get-ADGroupMembers-Get-AD-0ee3ae48)
Expand All @@ -71,6 +81,6 @@ I've copied and will continue to update my TechNet gallery contributions within
* [Open-ISEFunction](http://gallery.technet.microsoft.com/Open-defined-functions-in-22788d0f)
* [Test-ForAdmin](http://gallery.technet.microsoft.com/Test-ForAdmin-Verify-75d84aba)

# Help!
## Help!

Would love contributors, suggestions, feedback, and other help!

0 comments on commit 4653b5e

Please sign in to comment.