SlideShare a Scribd company logo
Manage your infrastructure
with PowerShell
@Jaap_BrasserJaap Brasser
• Dutch PowerShell User Group!
• PowerShell Conference Europe
• PowerShell Conference Asia
• Slack
• Reddit
• GitHub
• PowerShell Gallery
• TechNet Forums/Gallery
About_Jaap
@Jaap_Brasser
Manage your infrastructure with PowerShell
Agenda
• Structured output – Objects!
• Hostname of the system
• Domain name of system
• OS info
• Memory info
• System disk
• Pagefile
• Create a function
Building the tools
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
Demo 2 – Get System Domain
Demo
Summary
• Found the user domain
• Found the system domain
• Merged output with previous output
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
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
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
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
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
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?

More Related Content

What's hot (20)

PPTX
A brave new world – mac os x, power shell and linux
Jaap Brasser
 
PPTX
Writing power shell the right tool for the job
Jaap Brasser
 
PPTX
Secure your servers in time with JIT and JEA
Jaap Brasser
 
PPTX
Breakdown the GUI - PowerShell logging to automate everything
Jaap Brasser
 
PPTX
Building your own JEA Configuration
Jaap Brasser
 
PPTX
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
Sencha
 
PDF
Hello world - intro to node js
Refresh Annapolis Valley
 
PPTX
Azure DevOps Overview [Arabic]
ahmadezzeir
 
PPTX
Power shell v3 session1
Vladimir Márquez
 
PPTX
Neil Peterson - Azure CLI Deep Dive
WinOps Conf
 
PPTX
PowerShell for SharePoint Admins
Rick Taylor
 
PPTX
Automation: PowerShell & DSC
Josh Gillespie
 
PPTX
Getting Started with ASP.NET 5
Brij Mishra
 
PPTX
10 tips to make your ASP.NET Apps Faster
Brij Mishra
 
PDF
Practical Continuous Deployment - Atlassian - London AUG 18 Feb 2014
Matthew Cobby
 
PPTX
Ansible Best Practices - July 30
tylerturk
 
PPTX
SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...
Sencha
 
PPTX
Docker With Asp.net Core
Fatih Şimşek
 
PDF
Know thy cost (or where performance problems lurk)
Oren Eini
 
PPTX
Automatize everything
Boris Bucha
 
A brave new world – mac os x, power shell and linux
Jaap Brasser
 
Writing power shell the right tool for the job
Jaap Brasser
 
Secure your servers in time with JIT and JEA
Jaap Brasser
 
Breakdown the GUI - PowerShell logging to automate everything
Jaap Brasser
 
Building your own JEA Configuration
Jaap Brasser
 
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
Sencha
 
Hello world - intro to node js
Refresh Annapolis Valley
 
Azure DevOps Overview [Arabic]
ahmadezzeir
 
Power shell v3 session1
Vladimir Márquez
 
Neil Peterson - Azure CLI Deep Dive
WinOps Conf
 
PowerShell for SharePoint Admins
Rick Taylor
 
Automation: PowerShell & DSC
Josh Gillespie
 
Getting Started with ASP.NET 5
Brij Mishra
 
10 tips to make your ASP.NET Apps Faster
Brij Mishra
 
Practical Continuous Deployment - Atlassian - London AUG 18 Feb 2014
Matthew Cobby
 
Ansible Best Practices - July 30
tylerturk
 
SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...
Sencha
 
Docker With Asp.net Core
Fatih Şimşek
 
Know thy cost (or where performance problems lurk)
Oren Eini
 
Automatize everything
Boris Bucha
 

Similar to Manage your infrastructure with PowerShell (20)

PDF
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
Hitesh Mohapatra
 
PPTX
Powershell Tech Ed2009
rsnarayanan
 
PPT
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
PPTX
PowerShell - Be A Cool Blue Kid
Matthew Johnson
 
PPTX
Powershell For Developers
Ido Flatow
 
PPT
No-script PowerShell v2
Concentrated Technology
 
PPTX
Powershell for Log Analysis and Data Crunching
Michelle D'israeli
 
TXT
An a z index of windows power shell commandss
Ben Pope
 
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra
 
PPTX
Inventory your network and clients with PowerShell
Concentrated Technology
 
PPTX
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
PDF
Windows PowerShell Step by Step 3rd Edition Wilson
phelpskwasia36
 
PPT
PowerShell crashcourse
Concentrated Technology
 
PPTX
The Power of PowerShell: Advanced
Microsoft TechNet - Belgium and Luxembourg
 
PPTX
PowerShell crash course
Concentrated Technology
 
PPT
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 
PPTX
Power Shell for System Admins - By Kaustubh
Kaustubh Kumar
 
PDF
Windows Powershell Step By Step 3rd Edition Wilson Ed
forsenqenan
 
PPTX
PowerShell crashcourse for Sharepoint admins
Concentrated Technology
 
PPTX
An Introduction to PowerShell for Security Assessments
EnclaveSecurity
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
Hitesh Mohapatra
 
Powershell Tech Ed2009
rsnarayanan
 
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
PowerShell - Be A Cool Blue Kid
Matthew Johnson
 
Powershell For Developers
Ido Flatow
 
No-script PowerShell v2
Concentrated Technology
 
Powershell for Log Analysis and Data Crunching
Michelle D'israeli
 
An a z index of windows power shell commandss
Ben Pope
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra
 
Inventory your network and clients with PowerShell
Concentrated Technology
 
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
Windows PowerShell Step by Step 3rd Edition Wilson
phelpskwasia36
 
PowerShell crashcourse
Concentrated Technology
 
The Power of PowerShell: Advanced
Microsoft TechNet - Belgium and Luxembourg
 
PowerShell crash course
Concentrated Technology
 
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 
Power Shell for System Admins - By Kaustubh
Kaustubh Kumar
 
Windows Powershell Step By Step 3rd Edition Wilson Ed
forsenqenan
 
PowerShell crashcourse for Sharepoint admins
Concentrated Technology
 
An Introduction to PowerShell for Security Assessments
EnclaveSecurity
 
Ad

More from Jaap Brasser (20)

PDF
Level up your SQL and Azure, by using Rubrik
Jaap Brasser
 
PDF
Your first PowerShell script: Open the door to automation
Jaap Brasser
 
PDF
Write Serverless Applications with PowerShell and Azure Functions
Jaap Brasser
 
PDF
From PowerShell Function to Serverless code with Azure Functions
Jaap Brasser
 
PDF
Discover Microsoft's Cloud Automation Suite
Jaap Brasser
 
PDF
Bridge the gap with Chat Automation
Jaap Brasser
 
PDF
Automate Anything with Microsoft Flow
Jaap Brasser
 
PDF
Automate everything with PowerShell
Jaap Brasser
 
PDF
Automate yourself out of a job - Use ChatOps!
Jaap Brasser
 
PDF
Create awesome Azure Functions with PowerShell
Jaap Brasser
 
PDF
Microsoft Flow and PowerShell combined to automate everything
Jaap Brasser
 
PDF
Workshop automating with microsoft flow
Jaap Brasser
 
PDF
Automate it with Azure Functions
Jaap Brasser
 
PDF
Using Microsoft Flow for IT Professionals
Jaap Brasser
 
PDF
Automating everything with Microsoft Flow
Jaap Brasser
 
PDF
Go with the flow!
Jaap Brasser
 
PDF
Navigate around the edge with PowerShell
Jaap Brasser
 
PDF
Using Chat Automation - ChatOps
Jaap Brasser
 
PDF
Automate it with Azure Functions
Jaap Brasser
 
PPTX
Bringing Dev and Ops together with ChatOps
Jaap Brasser
 
Level up your SQL and Azure, by using Rubrik
Jaap Brasser
 
Your first PowerShell script: Open the door to automation
Jaap Brasser
 
Write Serverless Applications with PowerShell and Azure Functions
Jaap Brasser
 
From PowerShell Function to Serverless code with Azure Functions
Jaap Brasser
 
Discover Microsoft's Cloud Automation Suite
Jaap Brasser
 
Bridge the gap with Chat Automation
Jaap Brasser
 
Automate Anything with Microsoft Flow
Jaap Brasser
 
Automate everything with PowerShell
Jaap Brasser
 
Automate yourself out of a job - Use ChatOps!
Jaap Brasser
 
Create awesome Azure Functions with PowerShell
Jaap Brasser
 
Microsoft Flow and PowerShell combined to automate everything
Jaap Brasser
 
Workshop automating with microsoft flow
Jaap Brasser
 
Automate it with Azure Functions
Jaap Brasser
 
Using Microsoft Flow for IT Professionals
Jaap Brasser
 
Automating everything with Microsoft Flow
Jaap Brasser
 
Go with the flow!
Jaap Brasser
 
Navigate around the edge with PowerShell
Jaap Brasser
 
Using Chat Automation - ChatOps
Jaap Brasser
 
Automate it with Azure Functions
Jaap Brasser
 
Bringing Dev and Ops together with ChatOps
Jaap Brasser
 
Ad

Recently uploaded (20)

PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PDF
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
The Future of Artificial Intelligence (AI)
Mukul
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 

Manage your infrastructure with PowerShell

  • 1. Manage your infrastructure with PowerShell @Jaap_BrasserJaap Brasser
  • 2. • Dutch PowerShell User Group! • PowerShell Conference Europe • PowerShell Conference Asia • Slack • Reddit • GitHub • PowerShell Gallery • TechNet Forums/Gallery About_Jaap @Jaap_Brasser
  • 5. • Structured output – Objects! • Hostname of the system • Domain name of system • OS info • Memory info • System disk • Pagefile • Create a function Building the tools
  • 6. Demo 1 - Retrieve hostname
  • 7. 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
  • 8. Demo 2 – Get System Domain
  • 9. Demo Summary • Found the user domain • Found the system domain • Merged output with previous output
  • 10. Demo 3 – OS Information
  • 11. 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
  • 12. Demo 4 – Memory Information
  • 13. Demo Summary • Retrieved information from ComputerSystem • Divided by GB • Strong typed as integer to remove rounding • Used format operator to create string
  • 14. Demo 5 - Timezones
  • 15. 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
  • 16. Demo 6 – System Disk Size
  • 17. 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
  • 18. Demo 7 – Pagefile from registry
  • 19. 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
  • 20. Demo 8 – Create the function
  • 21. 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