PowerShell for IT Professionals [#10] – Remote management with PowerShell

In this lesson we’re going to learn how to do one-to-one and one-to-many remote management with PowerShell. There’s no need for telnet, ssh or psexec as PowerShell has its own protocol that’s built in right into Windows. We will look at how to create interactive sessions and send commands to multiple servers at once. Exercises Notes Enable-Psremoting Enter-PSSesion ps-svr1 Hostname Get-Service GIP # I can even run commands that are not available on my source machine Get-ADDomainController Get-ADUser Exit or Exit-PSSession # Caution about double hoping Invoke-Command Invoke-Command -computerName ps-svr1 -command { get-service} # Invoke command executes commands on the remote comptuers and brings back the results # Can you tell a difference?...

24 August 2020 · 1 min · 176 words · Kamil

PowerShell for IT Professionals [#9] – Setting up Active Directory

Exercises On domain controller, find module that allows to manage Active Directory List all the Active Directory users List members of “Enterprise Administrators” Find the feature name for Windows Server Backup and install it with PowerShell Commands ### Server # Check IP configuration # Show steps in Server how to install # Check hostname Hostname # Rename server Rename-Computer ps-svr1 # Restart computer Reboot-computer # Get-WindowsFeature # Install-WindowsFeature Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools Install-ADDSForest -DomainName posh....

19 August 2020 · 1 min · 85 words · Kamil

PowerShell for IT Professionals [#8] – Manage everything with PowerShell

Exercises Can you uninstall module that was installed with Install-Module? Confirm your answer with Get-Module -ListAvaiable Can you update the installed module? Perhaps, you’d like to install version 1.0.0.0 of SNMP module, how can you force Install-Module to do so? Install-Module error If you encounter the issue with downloading modules, run this commandlet as a temporary workaround (it must be applied every time the shell is restarted): Source of solution, and also permanent solution can be found at:...

14 August 2020 · 1 min · 142 words · Kamil

PowerShell for IT Professionals [#7] – Formatting output

Exercises Send output of any commandlet, e.g. get service to Printer Lesson notes # So far, we've been using default PowerShell behaviour for formatting output # Although in the last lesson we did filtering data with Where-Object and Select-Object # We didn't really focus on how data is presented on the screen. Let's see what can be done here. # Let's have a look at local Get-LocalGroup Get-LocalGroup | Format-List #Alias is FL #Like with Select-Object, we can specify properties we're after Get-LocalGroup | fl -Property name,sid #Another example when List might be easier to read then table Get-CimInstance win32_ComputerSystem ## Format Table #ipconfig....

11 August 2020 · 2 min · 224 words · Kamil

PowerShell for IT Professionals [#6] – Filtering output

Exercises List all services that are stopped List all service that are stopped and they name begins with W Display only the Display Name of services that stopped and their name begins with W Lesson notes ### Filtering # Some commands accept wild cards in the search or have a filter parameter Get-Service -Name w*,b* #But there's more universal method, based on property names Get-Service | Where-Object -Filter {$_.Status -eq 'running' } #So let's break it down #Where-Object allows to filter out the incoming object based on the comparation operator #Most popular operators are: -eq - Equals -ne - Not equals -gt - Greather than -lt - Less then -le - Less than or equal -ge - Greater than or equal -Like -Notlike #There are more many, you can check these help topics: Help about_Operators Help about_Comparison_Operators #$_ is current object; it's what we're piping in our case Get-Service # ....

7 August 2020 · 2 min · 291 words · Kamil