Admin Power

Chapter 15 of 18

Chapter 15: Small Commands, Big Everyday Wins

This chapter is a handy toolbox of smaller jobs that do not need a whole chapter each. You will fetch web content, set stricter password rules for one group, check network adapters and addresses, rename a computer, write to a file, read the time, change the keyboard list, and move data in and out of CSV files. That matters because real admin days are full of these small jobs, and knowing the right one line for each one saves you a lot of clicking around. Each lesson is short and practical, and you can use each tool on its own. After this chapter, you will be able to handle these everyday tasks with confidence, and you will know how to preview your work before you act on it.

5 lessons 3 learning objectives 18 related commands

Topics at a glance: Internet: get content from a web page, Fine grained password policies (FGPP), Network: adapters, IP addresses, and DNS, Host, files, time, and keyboard, CSV: import and export.

Where this chapter fits

This chapter comes after Chapter 14: Set Rules Once, Apply Them Everywhere in the journey, so ideas from that chapter will feel familiar here.

After this chapter comes Chapter 16: PowerShell for Ethical Hackers.

Learning objectives

By the end of this chapter, you will be able to:

  • Fetch web content with Invoke-WebRequest
  • Create and assign a fine grained password policy
  • Manage IP, DNS, host, time, keyboard, and CSV tasks

Lessons in this chapter

Work through the lessons in order. Each lesson page has explanations, examples, common mistakes, and a knowledge check.

  1. Lesson 1: Internet: get content from a web page

    Invoke-WebRequest fetches a web page or a file over HTTP. It returns a response object with status, headers, and content, which you can inspect or save.

    3 things to learn in this lesson

  2. Lesson 2: Fine grained password policies (FGPP)

    A fine grained password policy gives a different password and lockout policy to a group of users, instead of one policy for the whole domain. It is applied through a password settings object.

    3 things to learn in this lesson

  3. Lesson 3: Network: adapters, IP addresses, and DNS

    Network settings live on adapters. PowerShell reads adapters, reads and sets IP addresses, reads and sets DNS servers, and changes the default route, all per adapter.

    3 things to learn in this lesson

  4. Lesson 4: Host, files, time, and keyboard

    Four small jobs, one lesson: rename a computer, write text to a file, read the date and time, and change the keyboard layout list.

    3 things to learn in this lesson

  5. Lesson 5: CSV: import and export

    CSV files are tables in text form. Import-Csv turns rows into objects, and Export-Csv turns objects into rows. Together, they connect PowerShell to spreadsheets and to other tools.

    3 things to learn in this lesson

Related command references

These command pages are linked to lessons in this chapter. Each command page has its syntax, parameters, and examples.

  • Get-Date

    Returns the current date and time as a datetime object.

    From the lesson: Host, files, time, and keyboard

  • New-ADFineGrainedPasswordPolicy

    Creates a fine grained password policy object.

    From the lesson: Fine grained password policies (FGPP)

  • Add-ADFineGrainedPasswordPolicySubject

    Assigns a fine grained password policy to a group or user.

    From the lesson: Fine grained password policies (FGPP)

  • Get-ADFineGrainedPasswordPolicy

    Reads fine grained password policies.

    From the lesson: Fine grained password policies (FGPP)

  • Get-NetIPAddress

    Shows IP addresses per adapter.

    From the lesson: Network: adapters, IP addresses, and DNS

  • New-NetIPAddress

    Adds an IP address to an adapter.

    From the lesson: Network: adapters, IP addresses, and DNS

  • Set-NetIPAddress

    Changes an existing IP address on an adapter.

    From the lesson: Network: adapters, IP addresses, and DNS

  • Get-DnsClientServerAddress

    Shows DNS server addresses per adapter.

    From the lesson: Network: adapters, IP addresses, and DNS

  • Set-DnsClientServerAddress

    Sets DNS server addresses for an adapter.

    From the lesson: Network: adapters, IP addresses, and DNS

  • Get-NetAdapter

    Lists network adapters with names, status, and speeds.

    From the lesson: Network: adapters, IP addresses, and DNS

  • Get-WinUserLanguageList

    Shows the user language and keyboard layout list.

    From the lesson: Host, files, time, and keyboard

  • Set-WinUserLanguageList

    Sets the user language and keyboard layout list.

    From the lesson: Host, files, time, and keyboard

  • Rename-Computer

    Renames the computer. Usually needs a restart.

    From the lesson: Host, files, time, and keyboard

  • Import-Csv

    Reads a CSV file into one object per row.

    From the lesson: CSV: import and export

  • Export-Csv

    Writes objects to a CSV file.

    From the lesson: CSV: import and export

  • Invoke-WebRequest

    Fetches web content over HTTP and returns a response object.

    From the lesson: Internet: get content from a web page

  • Set-Content

    Writes text to a file, replacing it if it exists.

    From the lesson: Host, files, time, and keyboard

  • Add-Content

    Appends text to a file, without replacing it.

    From the lesson: Host, files, time, and keyboard

Tip: read the lesson first, then use the command page as a quick reference.