Lab Answer Key: Module 11: Introduction To Managing SQL Server Using Powershell Lab: Using Powershell To Manage SQL Server
Lab Answer Key: Module 11: Introduction To Managing SQL Server Using Powershell Lab: Using Powershell To Manage SQL Server
4. At the command prompt, type Get-Help, and then press Enter to display the
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 1/5
30/1/2019 Librería
5. At the command prompt, type Get-Help Get-ChildItem, and then press Enter to
display help for the cmdlet.
6. At the command prompt, type Get-Command Remove-*, and then press Enter
Es
te
do a list of all the cmdlets that start with the verb Remove-.
to get
cu
me
nto
pe
rte
7. At
No the command
lui
s
ne prompt, type Get-Command *sql*, and then press Enter to get
c
es gu ea
tán ille Lu
a list ofeall
p
rm
the ocmdlets
r m
co
is that include “sql”.
Gu
itid rre ille
as a@ rm
las gm oC
8. At the commandopprompt, c
ias
a il.c type
om
orrGet-Item,
ea and then press TAB to view tab-
sin Lo
pe
completion of the cmdlet. au
tor
ra.
iza
ció
n.
9. Press ESC to clear the command.
Es
te
do
cu
me PowerShell Providers
Task 3: Using
nto
pe
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
oc
Gu type Get-PsProvider, and then press Enter to list the
1. At the command
rm
itid orrprompt,
e ille
as a@ rm
oC
gmand valid las
PowerShell providers
co ail orr locations.
pia .co ea
ss m Lo
in pe
au . ra
2. At the command prompt,toritype
za Set-Location Env:, and then press Enter to go to
ció
n .
the Environment location.
3. At the command prompt, type Get-ChildItem, and then press Enter to list the
Econtents
ste
of the location.
do
cu
me
4. At the command nto
pe
prompt, type Get-PSDrive, and then press Enter to list the
rte
No
available lui drives. ne
es sg ce
tán uil aL
ler uis
pe mo
rm co Gu
5. Compare itthe ida PSDrives
sl
rre
a @
ille
with
rm the PSProviders.
oC
as gm
co ail orr
pia .co ea
ss m Lo
6. At the command prompt, in
au type Import-Module
pe
ra. SQLPS, and then press Enter to
tor
iza
import the SQL PowerShell cimodule.
ón You can ignore any warnings that appear.
.
7. At the command prompt, type Get-PsProvider, and then press Enter to list the
PowerShell providers. Note that SqlServer now appears in the list.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 2/5
30/1/2019 Librería
8. At the command prompt, type Get-PSDrive, and then press Enter to list the
available drives. Note that SqlServer now appears in the list.
9. At the command prompt, type Get-Help Get-PSProvider, press Enter, and then
read the returned information to learn more about the PSProvider cmdlet.
Es
te
do
c
10. At theumcommand
en
t
prompt, type Get-Help Get-PSDrive, press Enter, and then
op
ert
read
No the
lui returned
en
e information to learn more about the PSDrive cmdlet.
es sg ce
tán u ille aL
pe rm uis
rm Gu oc
11. At the command
itid
a
orrprompt,
ea ille type Exit to close the console.
r sl @ mo
as gm Co
co ail rre
pia .co aL
ss m op
in era
au .
tor
iza
ció
Result: After completing this exercise,
. you will have investigated PowerShell help
n
Es
ed t
Exerciseoc 2: Using PowerShell to Change SQL Server Settings
um
en
to
pe
rte
No lui ne
es sg ce
tán u ille a
Task 1: View
pe Database
rm
o
LuSettings
is
rm co Gu
itid rre ille
as a@ rm
las gm oC
orr co ail
ea pia .co
ss m Lo
1. On the Start menu, type
in
au
Windows pPowerShell,
era right-click Windows
tor .
PowerShell, and then click iza Run ISE as Administrator.
ció
n.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 3/5
30/1/2019 Librería
7. Select the code under the #3# comment, and then on the toolbar, click Run
Selection to get the database object.
8. Select the code under the #4# comment, and then on the toolbar, click Run
Selection to display the database properties.
Es
te
9. do the code under the #5# comment, and then on the toolbar, click Run
Select
cu
me
n
to to display the database option.
Selection pe
r
No lui ten
sg ec
es u ea
tán ille Lu
pe rm is
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
co orr
ail
.co
pia ea
Task 2: Amend Database
s sin Settings Lope
m
au ra.
tor
iza
ció
n.
1. On the File menu, click Open.
6. ESelect
ste
the code under the #4# comment, and then on the toolbar, click Run
do
Selection
cu
me to change the compatibility level of the AdventureWorks2016
nto
database. perte
No lui ne
es sg ce
tán uil aL
ler uis
7. Selectpthe erm code mo under
co Guthe #5# comment, and then on the toolbar, click Run
itid rre ille
as a@ rm
Selection to lchange as
co
gmthe
ail
ANSI
o C nulls, autoshrink, read only, and recovery model
orr
pia .co ea
options. ss
in
m Lo
pe
au ra.
tor
iza
ció
n.
3. Select the code under the #1# comment, and then on the toolbar, click Run
Es
te
do
Selection to display “import the SQL module”. Ignore any warnings that may
cu
m en
to
appear. pe
rte
No lui ne
es sgce
tán u aL
ille
4. Select the uis the #2# comment,
erm code oc under and then on the toolbar, click Run
p r m
orr Gu
itid ea ille
a
Selection to lchange
s @ the rlocation.
mo
as gm Co
co ail rre
pia .co aL
ss m op
in era
5. Select the code underathe uto #3# comment, . and then on the toolbar, click Run
riz
ac
Selection to get the server object. ión
.
6. Select the code under the #4# comment, and then on the toolbar, click Run
Selection to display the Settings object.
Es
te
do
c
7. Selectumthe
en code under the #5# comment, and then on the toolbar, click Run
to
ert p
Selection
N lu to echange
ne the login mode to mixed authentication.
oe isg ce
stá uil aL
np ler uis
erm mo
8. Guthe #6# comment, and then on the toolbar, click Run
Select theitidcodecounder
rre ille
as a@ rm
gm las o
Selection to change
co
p
the
ail login
.
Co mode back to integrated authentication.
rre
ias co aL
op
sin m
era
au
t .
9. Select the code under theriza#7# comment,
o and then on the toolbar, click Run
ció
n.
Selection to examine the UserOptions object.
10. Select the code under the #8# comment, and then on the toolbar, click Run
ESelection
ste
to change some server settings.
do
cu
me
11. Select the nto code under the #9# comment, and
pe then on the toolbar, click Run
rte
N l u ne
Selection
oe
stá
isg to reset
uil
ce the server settings.
l erm aL
np uis
erm oc Gu
itid o rre ille
12. On the File amenu,
sl a click
@ Exit.
rm
oC
as gm
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
tor
iza
ció
n.
Result: After completing this lab exercise, you will have PowerShell scripts to
show the IT Director.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 5/5