Skip to content

Commit 65ffba2

Browse files
RobRob
Rob
authored and
Rob
committed
various things
1 parent 2f85b70 commit 65ffba2

12 files changed

+116
-173
lines changed

Setting up.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"\r\n",
3030
"In Azure Data Studio install the PowerShell Extension using the Extensions Icon on the left\r\n",
3131
"\r\n",
32-
"![powershell](.\\Images\\Extension.png)\r\n",
32+
"![powershell](.\\images\\Extension.png)\r\n",
3333
"\r\n",
3434
"type Power and then click install on the PowerShell Extension\r\n",
3535
"\r\n",
@@ -179,4 +179,4 @@
179179
}
180180
}
181181
]
182-
}
182+
}

notebooks/NotDotNet/03 - Using PowerShell Notebooks in Azure Data Studio.ipynb

+27-8
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@
4343
{
4444
"cell_type": "code",
4545
"source": [
46-
"Get-Location"
46+
"Get-Location\r\n",
47+
"# D:\\OneDrive\\Documents\\GitHub\\JupyterNotebooks\\notebooks\\NotDotNet\\03 - Using PowerShell Notebooks in Azure Data Studio.ipynb"
4748
],
4849
"metadata": {
4950
"azdata_cell_guid": "d3dea4b5-5b23-4294-8639-3338b37c222a"
5051
},
51-
"outputs": [],
52+
"outputs": [
53+
{
54+
"name": "stdout",
55+
"text": "\nPath \n---- \nD:\\OneDrive\n\n\n",
56+
"output_type": "stream"
57+
}
58+
],
5259
"execution_count": 2
5360
},
5461
{
@@ -103,8 +110,14 @@
103110
"hide_input"
104111
]
105112
},
106-
"outputs": [],
107-
"execution_count": 4
113+
"outputs": [
114+
{
115+
"name": "stdout",
116+
"text": "\nDescribing Checking Problem ...... by THEBEARD Rob\n\n Context Are all the services running ?\n [+] The Service Audiosrv should be running 113ms\n [-] The Service BITS should be running 29ms\n Expected 'Running', because Service XXXX requires the service BITS to be running, but got Stopped.\n 8: (Get-Service -ComputerName localhost -Name $Service).Status | Should -Be 'Running' -Because \"Service XXXX requires the service $Service to be running\"\nGet-Service : Cannot find any service with service name 'com.docker.service'.\nAt line:8 char:18\n+ ... (Get-Service -ComputerName localhost -Name $Service).Statu ...\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : ObjectNotFound: (com.docker.service:String) [Get-Service], ServiceCommandException\n + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand\n \n [-] The Service com.docker.service should be running 47ms\n Expected 'Running', because Service XXXX requires the service com.docker.service to be running, but got $null.\n 8: (Get-Service -ComputerName localhost -Name $Service).Status | Should -Be 'Running' -Because \"Service XXXX requires the service $Service to be running\"\n [+] The Service EventLog should be running 7ms\nGet-Service : Cannot find any service with service name 'MSSQLSERVER'.\nAt line:8 char:18\n+ ... (Get-Service -ComputerName localhost -Name $Service).Statu ...\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : ObjectNotFound: (MSSQLSERVER:String) [Get-Service], ServiceCommandException\n + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand\n \n [-] The Service MSSQLSERVER should be running 11ms\n Expected 'Running', because Service XXXX requires the service MSSQLSERVER to be running, but got $null.\n 8: (Get-Service -ComputerName localhost -Name $Service).Status | Should -Be 'Running' -Because \"Service XXXX requires the service $Service to be running\"\n [+] The Service Spooler should be running 5ms\n",
117+
"output_type": "stream"
118+
}
119+
],
120+
"execution_count": 3
108121
},
109122
{
110123
"cell_type": "markdown",
@@ -126,8 +139,14 @@
126139
"metadata": {
127140
"azdata_cell_guid": "47345e89-bdac-4670-b875-ba0f72cefff4"
128141
},
129-
"outputs": [],
130-
"execution_count": 6
142+
"outputs": [
143+
{
144+
"name": "stdout",
145+
"text": "Get-Service : Cannot find any service with service name 'MSSQLSERVER'.\nAt line:3 char:1\n+ Get-Service $ServicesToStart | Start-Service\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : ObjectNotFound: (MSSQLSERVER:String) [Get-Service], ServiceCommandException\n + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand\n \n",
146+
"output_type": "stream"
147+
}
148+
],
149+
"execution_count": 4
131150
},
132151
{
133152
"cell_type": "markdown",
@@ -163,7 +182,7 @@
163182
]
164183
},
165184
"outputs": [],
166-
"execution_count": 0
185+
"execution_count": null
167186
},
168187
{
169188
"cell_type": "markdown",
@@ -185,7 +204,7 @@
185204
"azdata_cell_guid": "da20e213-31a4-4002-80b7-70a7f8fec935"
186205
},
187206
"outputs": [],
188-
"execution_count": 0
207+
"execution_count": null
189208
}
190209
]
191210
}

notebooks/NotDotNet/Agent/AGENT - Agent Jobs and schedules to Excel.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@
8989
],
9090
"metadata": {
9191
"azdata_cell_guid": "0ad19104-eb88-4c73-bfee-197cc6946f07",
92-
"tags": [
93-
"hide_input"
94-
]
92+
"tags": []
9593
},
9694
"outputs": [],
9795
"execution_count": null

notebooks/NotDotNet/Agent/AGENT - Checking Agent Job Failures.ipynb

+3-9
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,8 @@
6464
"hide_input"
6565
]
6666
},
67-
"outputs": [
68-
{
69-
"output_type": "stream",
70-
"name": "stdout",
71-
"text": "We have the dbatools module already\nWe have the importExcel module already\n"
72-
}
73-
],
74-
"execution_count": 1
67+
"outputs": [],
68+
"execution_count": null
7569
},
7670
{
7771
"cell_type": "markdown",
@@ -86,7 +80,7 @@
8680
{
8781
"cell_type": "code",
8882
"source": [
89-
"$AllInstances = '' # add array of instances here\r\n",
83+
"$AllInstances = 'SQL2017N5' # add array of instances here\r\n",
9084
"Set-DbcConfig agent.failedjob.since -Value 1\r\n",
9185
"Invoke-DbcCheck -SqlInstance $AllInstances -Check FailedJob -Show Fails"
9286
],

notebooks/NotDotNet/Agent/AGENT - Exporting to source control.ipynb

+7-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
{
4444
"cell_type": "code",
4545
"source": [
46-
"cd '\\' ## Change this to your own local path\r\n",
46+
"cd 'D:\\OneDrive\\Documents\\GitHub\\SQLAgentExport' ## Change this to your own local path\r\n",
4747
"\r\n",
4848
"git status"
4949
],
@@ -133,7 +133,7 @@
133133
{
134134
"cell_type": "markdown",
135135
"source": [
136-
"We will load the PowerShell that will do this into a function "
136+
"We will load the PowerShell that will do this from a function . You will need to alter the path to the `Export-TheSqlAgentJobs.ps1` file "
137137
],
138138
"metadata": {
139139
"azdata_cell_guid": "df1b4e1b-06e3-4fb3-ae3c-525b113bc05d"
@@ -142,7 +142,7 @@
142142
{
143143
"cell_type": "code",
144144
"source": [
145-
"Import-Module Export-TheSqlAgentJobs.ps1\r\n",
145+
"Import-Module ..\\JupyterNotebooks\\notebooks\\NotDotNet\\Agent\\Export-TheSqlAgentJobs.ps1 # ALter this to the right path\r\n",
146146
""
147147
],
148148
"metadata": {
@@ -190,8 +190,9 @@
190190
{
191191
"cell_type": "code",
192192
"source": [
193-
"$ExportPath = 'SQLAgentJobs\\PreProd' # change this to the correct environment Prod\r\n",
194-
"$SqlInstances = $PreProdInstances # $ProdInstances # Change this to the instance(s) you wish to export\r\n",
193+
"$ExportPath = 'SQLAgentJobs\\BeardNUC2' # change this to the correct environment Prod\n",
194+
"$BeardNUC2 = (Get-VM -ComputerName BEARDNUC2 |Where Name -like '*SQL*' | Where State -eq 'Running').Name\r\n",
195+
"$SqlInstances = $BeardNUC2 # $ProdInstances # Change this to the instance(s) you wish to export\r\n",
195196
"Export-TheAgentJobs -SqlInstance $SqlInstances -BaseDirectory $ExportPath"
196197
],
197198
"metadata": {
@@ -276,7 +277,7 @@
276277
{
277278
"cell_type": "code",
278279
"source": [
279-
"git commit -m 'updated following code improvements in copy and reset'\r\n",
280+
"git commit -m ''\r\n",
280281
""
281282
],
282283
"metadata": {

notebooks/NotDotNet/Agent/AGENT - Getting Run Time Webpage.ipynb

+10-9
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
},
7373
"outputs": [
7474
{
75-
"output_type": "stream",
7675
"name": "stdout",
77-
"text": "dbatools installed already\nWe have a C:\\Temp folder\n"
76+
"text": "The PowerShell Gallery is trusted I will continue\nWe have the dbatools module already\n",
77+
"output_type": "stream"
7878
}
7979
],
8080
"execution_count": 1
@@ -97,15 +97,16 @@
9797
"Invoke-Item $FileName"
9898
],
9999
"metadata": {
100-
"azdata_cell_guid": "4c5b928b-48ee-427d-a614-ae27b621397f"
100+
"azdata_cell_guid": "4c5b928b-48ee-427d-a614-ae27b621397f",
101+
"tags": []
101102
},
102103
"outputs": [
103-
{
104-
"name": "stdout",
105-
"text": "",
106-
"output_type": "stream"
107-
}
108-
],
104+
{
105+
"name": "stdout",
106+
"text": "",
107+
"output_type": "stream"
108+
}
109+
],
109110
"execution_count": 2
110111
},
111112
{

notebooks/NotDotNet/Audit/AUDIT - Instance Permissions to Excel.ipynb

+12-10
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@
6666
},
6767
"outputs": [
6868
{
69-
"output_type": "stream",
7069
"name": "stdout",
71-
"text": "The PowerShell Gallery is trusted I will continue\nWe have the dbatools module already\nWe have the importExcel module already\n"
70+
"text": "The PowerShell Gallery is trusted I will continue\nWe have the dbatools module already\nWe have the importExcel module already\n. {\n",
71+
"output_type": "stream"
7272
}
7373
],
74-
"execution_count": 1
74+
"execution_count": 2
7575
},
7676
{
7777
"cell_type": "markdown",
@@ -102,12 +102,12 @@
102102
},
103103
"outputs": [
104104
{
105-
"output_type": "stream",
106105
"name": "stdout",
107-
"text": ""
106+
"text": "",
107+
"output_type": "stream"
108108
}
109109
],
110-
"execution_count": 2
110+
"execution_count": 5
111111
},
112112
{
113113
"cell_type": "markdown",
@@ -195,16 +195,18 @@
195195
],
196196
"metadata": {
197197
"azdata_cell_guid": "9fdad48b-965e-45ed-81a4-d999699dfa88",
198-
"tags": []
198+
"tags": [
199+
"hide_input"
200+
]
199201
},
200202
"outputs": [
201203
{
202-
"output_type": "stream",
203204
"name": "stdout",
204-
"text": "Processing SQL2017N5\n FileName is c:\\temp\\\\SQL2017N5_Permssions_OneTab_2020-05-02.xlsx\n\nFinished Processing SQL2017N5\n ############### \n FileName is c:\\temp\\\\SQL2017N5_Permssions_OneTab_2020-05-02.xlsx \n ############### \n\n"
205+
"text": "Processing SQL2017N5\n FileName is c:\\temp\\\\SQL2017N5_Permssions_OneTab_2020-05-30.xlsx\n\nFinished Processing SQL2017N5\n ############### \n FileName is c:\\temp\\\\SQL2017N5_Permssions_OneTab_2020-05-30.xlsx \n ############### \n\n",
206+
"output_type": "stream"
205207
}
206208
],
207-
"execution_count": 3
209+
"execution_count": 6
208210
},
209211
{
210212
"cell_type": "markdown",

0 commit comments

Comments
 (0)