Section 2 - Power Shell Flashcards

1
Q

What are powershells main verbs?

A

get
set
copy
move
new
add (like adding user to group)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to go forwards and backwards through commands that powershell tries to auto compete?

A

tab
shift

This is done through intelisense

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Get services then start and stop the Remote Management service

What would this service be known as in terms of powershell

Show the man page for stop-service

A

get-service
WinRM

stop-service -name “winrm”
start-service -name “winrm”

-name would be a parameter

winrm is a parameter

get-help stop-service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Show running processes
show the 5 newest system event logs
Change the formatting of this so you can see more information
Send this info to a text file

A

get-process
get-eventlog -logname system -newest 5 | format-list | out-file c:\log.txt
(this is normally formatted as a table)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Show all commands

Show a command that contains the word “net” and also the word “reset”

A

get-commands -noun net* -verb reset (use a wildcard)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Show current modules
What are they?
import activedirectory module

Where would you find downloadable modules?

download a command

A

They contain tons of commands

get-module

import-module -name activedirectory

powershellgallery.com
search what you want, click on it, copy the command that will download it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a forest, tree, and a forest?

A

Every Active Directory Domain must be part of a forest and a tree.

Tree - every child domain that contains the parents name

Forest - Domains in forest contain same schema. Schema makes up all objects and attributes. Multiple forests can be linked, but they won’t have the same schema, you can add a trust though

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why have multiple domains?

A

Big company over different countries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What would your child domain called UK be called in AD if your first domain was examlabpractice.com

What about if UK has a child domain?

A

uk.examlabpractice.com
scotland.uk.examlabpractice.com

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a trust relationship

A

Domains can share resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why go to multiple trees?

A

If a different naming convention needs to be used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What can domains part of the same forest share?

A

Resources - files, folders, printers

Scheme - Object templates and attributes (like you can look up a user in a different county in a same forest)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Where is the Active Directory database stored?

What partitions does this consist of?

A

NTDS.dir

Configuration - Replicates to every DC in Forest. Has info how forest is configured.

Schema - Makes all object and attributes for entire forest. IE: Has info on how to build users, groups, etc. It has a bunch of templates/blueprints basically. Replicates forest wide.

Domain - Unique per domain. Users, passwords, groups, etc. all stored here for your unique Domain. Replicates to only DCs in this domain.

Application (custom) - You can create this and choose what is stored here. For custom made objects and you can choose which DCs replicate this.
These two are actually in here:
-ForestDNSZone
-DomainDNSZone

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Global Catalog

A

Special job you can assign to a DC that replicates a subset of all objects in every domain’s “Domain” partition.

Purpose - Different computers can locate object in different domain.
I can look up a user if I’m in Australia for a domain in the US, but it won’t have all attributes about the object, just the subsets of objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

IMPORTANT

A

Just to be safe, create a domain name that is unique. If you copy someone else’s and integrate to the cloud this could cause problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Change hostname

Disable ipv6
give a unique ipv4 address and put it’s loopback as it’s DNS server

Install ADDS and add a new forest

A

Server Manager > local host > click name > yada yada

Roles and Features
After it’s done promote your server to a domain controller.

17
Q

What is the functional level of a DC

A

Highest functional level you can use according to your newest server.

This just says how up to date with features you can get.

Remember Global Catalog

18
Q

NETBios name?

A

For older devices. Legacy name.
Older devices = 1990s devices

19
Q

What is SYSVOL?

A

C:\Windows\SYSVOL

Group policy info and logon scripts are stored.

C:\Windows\NTDS

20
Q

Change hostname of your second server and add to domain

Confirm server is on the domain

A

Local server > click name > configure > also change domain to GameSharks.com

REMEMBER TO ADD DC1 AS YOUR DNS

Server Manager > AD users and computers > computers > you’ll see it here.

21
Q

Create a VM on Azure

A

Azuer > resource groups (area to add azure objects) >resource group “vmtest” > review > create > Go into it. > create > search for windows server 2022 > click it > search for 2022 in drop down box > create > AzureDC1 (for the name) > anyway, just go through the options until you pay for it.

To stop is:
Click on the AzureDC1 object and click Stop
Click the azuerdc1 object, copy the ip > click connect > open the file.

Azure pricing calculator < - if you want to know how much this will cost.

22
Q

What is RODC?

A

Read only domain controller

This can be useful if you have a small office somewhere where they don’t have a full time IT person. We can add a RODC here that can authenticate users. This is so something doesn’t mess up the whole Forest. This won’t replicate out, only things outside replicate in.

If it doesn’t have a password, it will request it to login from the rw DC.
It can actually have DNS.

23
Q

Set up a RODC server:
pre-stage
Add user to RODC group for fast authentication caching

A

pre-stage - you plan to set up a RODC server in the future. Like you have a server shipped to a location and you want it to be ready for it.

You can make this faster by disabling the NIC

Server Manager > tools > AD Users and Computers > Domain Controllers OU > Right click pre-create… > Group or user (you can give this to someone down at the location that I can help to configure there server) >

To specify what accounts will be cached for passwords
Right click RODC server > properties > Password Replication Policy > Deny all but one group, the employees will go into that allowed group.

Create a user and put them in that group

24
Q

Create a RODC server from the server itself

A

Install AD > promote to DC > add to domain >

If you have an error during this it needs to have the DC as the DNS

25
Q

What service is used for remote powershell?

What ports does it use?

A

5985 over http connection
5986 https for powershell

Computer Management > Services > WinRM Windows remote manage services

get-service -name winrm

winrm quickconfig

26
Q

Show services that are running on nyc-srv1 from the other server

Do this in a different way for getting the last 5 eventlogs for security

Now shell into the powershell of that system

Show the processes for two servers

A

Get-process -ComputerName nyc-svr1

Invoke-command -computername nyc-svr1 -scriptblock {get-eventlog -logname security -newest 5}

enter-pssession -computername nyc-svr1
exit

get-process -computername nyc-dc1,nyc-server1

27
Q

Create a variable for
number1 and have it equal 5
number2 and have it equal 10
Show your variables one at a time
Show all variables
subtract them

A

$number1 = 5
$number2 = 10
get-variable
$number1 - $number2

28
Q

Go into ISE
create a script that lets you enter
computer name
log type
latest amounts

to look up 10 newest application logs

Show as a list instead of a table

How would you run a single line?

A

ise
View - turn on the script thingy

$name = Read-host “Which computer would you like to connect to?”

$log = read-host “Which log would you like to see”

$amount = read-host “how many of the newest entries would you like to see?

get-eventlog -computername $name -logname $log -newest $amount |format-list

save as ps1 file

Highlight a line and click “play”

29
Q

What does FSMO mean

A

Flexible Single Master Operations

Changes replicate from DC to DC
Certain jobs shouldn’t have multiple writable copies or it would mess something up. The jobs:

Forest Level Roles (One writable copy per forest):
Normally stored in root of forest

Domain Naming Master - knows all the trusts. Makes sure all domain names are unique.

Scheme Master - Master copy of schema database - attributes and objects info to build.

Domain (every domain has a copy of these three roles ALL DCs have Read only copy of all the roles:

RID Master - Relative ID Master - Every object must have unique ID. This gives them out to objects.
Gives a RID pool out to a DC that they can use.

Infrastructure Master - group to user references. Like someone has access to resources in two different domains.

PDC Emulator Master - Password changes. Handles Time Syncing for sake of Kerberos. Handles Group Policies. Handles Legacy NT Boxes

30
Q

See all FSMO roles

PDC, Infrastructure, RID

Domain Master

Schema Master

A

Server Manager > tools > AD Users and Computers > Right click domain object > operation master > PDC, Infrastructure, RID

Server Manager > AD Domains and Trust > Right click Active Directory Domains and Trusts > Operations Master > Domain Master

Start > run > regsvr32 schmmgmt.dll

mmc.exe < - Microsoft Management Console > File > Add Remove Snap in > Add that tool > Right Click AD Schema > Operation Master

31
Q

If you want to transform a DCs FSMO role, how would you do it.

A

From the computer that you want to have the role.

Server Manager > tools > AD Users and Computers > Right click domain > operations masters > Click whichever > change … > yes

32
Q

What is seizing a role and how would you perform it?

A

if a role goes down unexpectedly, seizing can convert a read only copy.

CMD > ntdsutil > ? > Roles > enter > ? > Sieze PDC

POWERSHELL
move-addirectoryserveroperationmasterrole -identity nyc-svr1 -operationmasterrole

33
Q

Give yourself Privileges on ADDS

A

Portal.azure.com > Menu > Azure Azure Active Directory > click AAD DC Administrators > Click Members > add member > add yourself.