SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Reach the next level with
PowerShell
Jaap Brasser
@jaap_brasser
@Jaap_Brasser
jaapbrasser.com/about
• PowerShell Conf EU/Asia
• Dutch PowerShell User Group
• Blogging
• GitHub
• PowerShell Gallery
• TechNet Forums/Gallery
Agenda
PowerShell versions
• How to check your PowerShell version:
OS PowerShell version
Windows 7, Server2008R2 2.0
Windows 8, Server2012 3.0
Windows 8.1, Server 2012R2 4.0
Windows 10, Server 2016 5.0
Windows 10 Creators Update 5.1
$PSVersionTable
PowerShell language
Agenda
What are we building?
Requirements
1. Structured output – Objects!
2. Hostname of the system
3. Domain name of system
4. OS info
5. Memory info
6. System disk
7. Pagefile
8. IP info
9. Create a function
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 1
Retrieve hostname
Demo
Summary
• Found the host name of the system
• Looked at PowerShell drives
• Explored the Env: drive
• Found the hostname of the system
• Created a PowerShell object
• Exported the object to csv
• Opened csv in Excel
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 2
Get System Domain
Demo
Summary
• Found the user domain
• Found the system domain
• Merged output with previous output
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 3
OS Information
Demo
Summary
• Used the Win32_OperatingSystem class
• Retrieved the information
• Established Get-WmiObject is obsolete
• Used Get-CimInstance
• Help examples with array indexing
• Used WQL to speed up query
• Get-CimInstance hiding output
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 4
Memory information
Demo
Summary
• Retrieved information from ComputerSystem
• Divided by GB
• Strong typed as integer to remove rounding
• Used format operator to create string
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 5
Timezones
Demo
Summary
• Used the Get-TimeZone cmdlet
• Found out that the timezone description does
not take DST into account
• Used [datetime] type accelerator
• UtcNow
• Now
• Calculated actual time difference
• Combined output into a single string
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 6
System disk size
Demo
Summary
• Find out which disk is the system disk
• Find out how big the disk is
• Create the correct WQL query
• Format output into a string
• Set number of decimals for size in GB with
[math]::round
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 7
Pagefile from registry
Demo
Summary
• Found the registry provider PSDrive
• Looked at the ‘Memory Management’ key
• Retrieved the information using Get-
ItemProperty
• Used the –join operator to collapse the array
Agenda
• Differences between editors
• Configure VSCode
• Working with Vscode
• Setting up the ISE
• Working with the ISE and ISESteroids
• Questions
Demo 8
Create the function
Demo
Summary
• Create the Get-ComputerInformation function
• Create a hashtable
• Fill the values in the hashtable using output
from the commands created
• Convert the hashtable to a PowerShell custom
object
• Ran the function
Questions ? Github.com/jaapbrasser/Events/
Jaapbrasser.com

Contenu connexe

Tendances

PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint Admins
Rick Taylor
 

Tendances (20)

From zero to hero – learn how to automate from the gui
From zero to hero – learn how to automate from the guiFrom zero to hero – learn how to automate from the gui
From zero to hero – learn how to automate from the gui
 
Automating security with PowerShell
Automating security with PowerShellAutomating security with PowerShell
Automating security with PowerShell
 
Writing power shell the right tool for the job
Writing power shell   the right tool for the jobWriting power shell   the right tool for the job
Writing power shell the right tool for the job
 
Secure your servers in time with JIT and JEA
Secure your servers in time with JIT and JEASecure your servers in time with JIT and JEA
Secure your servers in time with JIT and JEA
 
Breakdown the GUI - PowerShell logging to automate everything
Breakdown the GUI - PowerShell logging to automate everythingBreakdown the GUI - PowerShell logging to automate everything
Breakdown the GUI - PowerShell logging to automate everything
 
Building your own JEA Configuration
Building your own JEA ConfigurationBuilding your own JEA Configuration
Building your own JEA Configuration
 
Hello world - intro to node js
Hello world - intro to node jsHello world - intro to node js
Hello world - intro to node js
 
Azure DevOps Overview [Arabic]
Azure DevOps Overview [Arabic]Azure DevOps Overview [Arabic]
Azure DevOps Overview [Arabic]
 
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
 
Automation: PowerShell & DSC
Automation: PowerShell & DSCAutomation: PowerShell & DSC
Automation: PowerShell & DSC
 
PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint Admins
 
Power shell v3 session1
Power shell v3   session1Power shell v3   session1
Power shell v3 session1
 
Developing Infrastructure Code for CI & CD
Developing Infrastructure Code for CI & CDDeveloping Infrastructure Code for CI & CD
Developing Infrastructure Code for CI & CD
 
RavenDB 3.5
RavenDB 3.5RavenDB 3.5
RavenDB 3.5
 
Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming
 
Operations Validation for Infrastructure As Code - PSConfEU 2016
Operations Validation for Infrastructure As Code - PSConfEU 2016Operations Validation for Infrastructure As Code - PSConfEU 2016
Operations Validation for Infrastructure As Code - PSConfEU 2016
 
Continuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as CodeContinuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as Code
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
The New Frontend Toolchain
The New Frontend ToolchainThe New Frontend Toolchain
The New Frontend Toolchain
 
Command box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPLCommand box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPL
 

Similaire à Reach the next level with PowerShell

August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
Howard Greenberg
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 

Similaire à Reach the next level with PowerShell (20)

SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
 
Node and Azure
Node and AzureNode and Azure
Node and Azure
 
Powering up on PowerShell - BSides Greenville 2019
Powering up on PowerShell  - BSides Greenville 2019Powering up on PowerShell  - BSides Greenville 2019
Powering up on PowerShell - BSides Greenville 2019
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi Vončina
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
 
Ow
OwOw
Ow
 
Beyond Domino Designer
Beyond Domino DesignerBeyond Domino Designer
Beyond Domino Designer
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
.NET7.pptx
.NET7.pptx.NET7.pptx
.NET7.pptx
 
Introducing Widows 7
Introducing Widows 7Introducing Widows 7
Introducing Widows 7
 
Testing microservices with docker
Testing microservices with dockerTesting microservices with docker
Testing microservices with docker
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 

Plus de Jaap Brasser

Plus de Jaap Brasser (20)

Level up your SQL and Azure, by using Rubrik
Level up your SQL and Azure, by using RubrikLevel up your SQL and Azure, by using Rubrik
Level up your SQL and Azure, by using Rubrik
 
Your first PowerShell script: Open the door to automation
Your first PowerShell script: Open the door to automationYour first PowerShell script: Open the door to automation
Your first PowerShell script: Open the door to automation
 
Write Serverless Applications with PowerShell and Azure Functions
Write Serverless Applications with PowerShell and Azure FunctionsWrite Serverless Applications with PowerShell and Azure Functions
Write Serverless Applications with PowerShell and Azure Functions
 
From PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure FunctionsFrom PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure Functions
 
Discover Microsoft's Cloud Automation Suite
Discover Microsoft's Cloud Automation SuiteDiscover Microsoft's Cloud Automation Suite
Discover Microsoft's Cloud Automation Suite
 
Bridge the gap with Chat Automation
Bridge the gap with Chat AutomationBridge the gap with Chat Automation
Bridge the gap with Chat Automation
 
Automate Anything with Microsoft Flow
Automate Anything with Microsoft FlowAutomate Anything with Microsoft Flow
Automate Anything with Microsoft Flow
 
Automate everything with PowerShell
Automate everything with PowerShellAutomate everything with PowerShell
Automate everything with PowerShell
 
Automate yourself out of a job - Use ChatOps!
Automate yourself out of a job - Use ChatOps!Automate yourself out of a job - Use ChatOps!
Automate yourself out of a job - Use ChatOps!
 
Create awesome Azure Functions with PowerShell
Create awesome Azure Functions with PowerShellCreate awesome Azure Functions with PowerShell
Create awesome Azure Functions with PowerShell
 
Microsoft Flow and PowerShell combined to automate everything
Microsoft Flow and PowerShell combined to automate everythingMicrosoft Flow and PowerShell combined to automate everything
Microsoft Flow and PowerShell combined to automate everything
 
Workshop automating with microsoft flow
Workshop   automating with microsoft flowWorkshop   automating with microsoft flow
Workshop automating with microsoft flow
 
Automate it with Azure Functions
Automate it with Azure FunctionsAutomate it with Azure Functions
Automate it with Azure Functions
 
Using Microsoft Flow for IT Professionals
Using Microsoft Flow for IT ProfessionalsUsing Microsoft Flow for IT Professionals
Using Microsoft Flow for IT Professionals
 
Automating everything with Microsoft Flow
Automating everything with Microsoft FlowAutomating everything with Microsoft Flow
Automating everything with Microsoft Flow
 
Go with the flow!
Go with the flow!Go with the flow!
Go with the flow!
 
Navigate around the edge with PowerShell
Navigate around the edge with PowerShellNavigate around the edge with PowerShell
Navigate around the edge with PowerShell
 
Using Chat Automation - ChatOps
Using Chat Automation - ChatOpsUsing Chat Automation - ChatOps
Using Chat Automation - ChatOps
 
Automate it with Azure Functions
Automate it with Azure FunctionsAutomate it with Azure Functions
Automate it with Azure Functions
 
Bringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOpsBringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOps
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Reach the next level with PowerShell

  • 1. Reach the next level with PowerShell Jaap Brasser @jaap_brasser
  • 2. @Jaap_Brasser jaapbrasser.com/about • PowerShell Conf EU/Asia • Dutch PowerShell User Group • Blogging • GitHub • PowerShell Gallery • TechNet Forums/Gallery
  • 4. PowerShell versions • How to check your PowerShell version: OS PowerShell version Windows 7, Server2008R2 2.0 Windows 8, Server2012 3.0 Windows 8.1, Server 2012R2 4.0 Windows 10, Server 2016 5.0 Windows 10 Creators Update 5.1 $PSVersionTable
  • 6. Agenda What are we building?
  • 7. Requirements 1. Structured output – Objects! 2. Hostname of the system 3. Domain name of system 4. OS info 5. Memory info 6. System disk 7. Pagefile 8. IP info 9. Create a function
  • 8. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 1 Retrieve hostname
  • 9. Demo Summary • Found the host name of the system • Looked at PowerShell drives • Explored the Env: drive • Found the hostname of the system • Created a PowerShell object • Exported the object to csv • Opened csv in Excel
  • 10. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 2 Get System Domain
  • 11. Demo Summary • Found the user domain • Found the system domain • Merged output with previous output
  • 12. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 3 OS Information
  • 13. Demo Summary • Used the Win32_OperatingSystem class • Retrieved the information • Established Get-WmiObject is obsolete • Used Get-CimInstance • Help examples with array indexing • Used WQL to speed up query • Get-CimInstance hiding output
  • 14. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 4 Memory information
  • 15. Demo Summary • Retrieved information from ComputerSystem • Divided by GB • Strong typed as integer to remove rounding • Used format operator to create string
  • 16. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 5 Timezones
  • 17. Demo Summary • Used the Get-TimeZone cmdlet • Found out that the timezone description does not take DST into account • Used [datetime] type accelerator • UtcNow • Now • Calculated actual time difference • Combined output into a single string
  • 18. • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 6 System disk size
  • 19. Demo Summary • Find out which disk is the system disk • Find out how big the disk is • Create the correct WQL query • Format output into a string • Set number of decimals for size in GB with [math]::round
  • 20. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 7 Pagefile from registry
  • 21. Demo Summary • Found the registry provider PSDrive • Looked at the ‘Memory Management’ key • Retrieved the information using Get- ItemProperty • Used the –join operator to collapse the array
  • 22. Agenda • Differences between editors • Configure VSCode • Working with Vscode • Setting up the ISE • Working with the ISE and ISESteroids • Questions Demo 8 Create the function
  • 23. Demo Summary • Create the Get-ComputerInformation function • Create a hashtable • Fill the values in the hashtable using output from the commands created • Convert the hashtable to a PowerShell custom object • Ran the function