PowerShell for IT Professionals [#11] – Variables

In this lesson we’re going to learn how what Variables are, why it’s good to use them and how to actually create them. We will then assign various values to variables to and use them solely, and in parameters. We will also have a look at foreach loop so that we can e.g. ping multiple computers using single variable with multiple objects in it. Exercises Use Get-Command to find all commands that allow you to manage variables....

29 August 2020 · 2 min · 371 words · Kamil

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