@@ -36,10 +36,44 @@ Invoke-SQLEscalatePriv
3636#
3737# #####################################################
3838
39- <#
40- Get-SQLQueryThreaded
41- Invoke-SQLOSCmd
42- #>
39+ # Invoke-SQLOSCmd
40+ Describe " Invoke-SQLOSCmd" {
41+ It " Should return results for the local host with query" {
42+ if ( (Invoke-SQLOSCmd - Command " whoami" | Measure-Object ).count -lt 1 ) {
43+ Throw " Incorrect OS command results returned"
44+ }
45+ }
46+ It " Should accept -Instance argument" {
47+ if ( (Invoke-SQLOSCmd - Instance $env: COMPUTERNAME - Command " whoami" | Measure-Object ).count -lt 1 ) {
48+ Throw " Incorrect OS command results returned"
49+ }
50+ }
51+ It " Should accept -Username and -Password arguments" {
52+ if ( (Invoke-SQLOSCmd - Instance $env: COMPUTERNAME - Command " whoami" - Username test - Password test | Measure-Object ).count -lt 1 ) {
53+ Throw " Incorrect column search results returned"
54+ }
55+ }
56+ It " Should accept -TimeOut argument" {
57+ if ( (Invoke-SQLOSCmd - Instance $env: COMPUTERNAME - TimeOut 5 - Command " whoami" | Measure-Object ).count -lt 1 ) {
58+ Throw " Incorrect OS command results returned"
59+ }
60+ }
61+ It " Should accept -Threads argument" {
62+ if ( (Invoke-SQLOSCmd - Instance $env: COMPUTERNAME - Threads 5 - Command " whoami" | Measure-Object ).count -lt 1 ) {
63+ Throw " Incorrect OS command results returned"
64+ }
65+ }
66+ It " Should accept -DAC flag" {
67+ if ( (Invoke-SQLOSCmd - Instance $env: COMPUTERNAME - DAC - Command " whoami" | Measure-Object ).count -lt 1 ) {
68+ Throw " Incorrect OS command results returned"
69+ }
70+ }
71+ It " Should accept pipeline input" {
72+ if ( ( Get-SQLInstanceLocal | Invoke-SQLOSCmd - Command " whoami" | Measure-Object ).count -lt 1 ) {
73+ Throw " Incorrect OS command results returned"
74+ }
75+ }
76+ }
4377
4478# Get-SQLQuery
4579Describe " Get-SQLQuery" {
0 commit comments