Google

03 November 2016

Classes, Objects and JSON in Windows PowerShell

PowerShell iconPowerShell is an excellent tool if you want to get tedious and repetitive tasks done quickly and correctly. In a new article in the kalmstrom.com Tips section I show how to create a class, objects and a JSON file in Windows PowerShell.

Enforced command prompt
In the computing world, a shell is a user interface that gives access to operating system services. If you start from the command prompt and make it much more powerful, you will have what Microsoft calls PowerShell.

Class, object and JSON
When you start writing a script in PowerShell, it is often useful to first create a class. The class describes an object and tells what could be done with it. I use a car as example, and in the class I add the properties wheels and color. I could of course also add more properties, like speed or even methods like driving and braking.

 Now I can create car objects based on the car class. For each object I define values for the class properties, and when I run the object script I can make things happen. Well, I cannot drive a car with a script - yet! - but I wanted to use an obvious example in my tutorial. When I write PowerShell scripts to use for computer processes I can certainly do a lot.

Objects can also be sent to JSON files, which you then can save in a directory and use in other processes.

Prominent toolKanban Task Manager for SharePoint logotype
PowerShell is one of the most prominent tools in the kalmstrom.com development box. We have a deep experience in automating SharePoint and Office 365 with PowerShell, and we can for example give PowerShell TimeCard for SharePoint iconscripts to subscribers who want to install or update multiple kanban boards or time reporting calendars in SharePoint.

Custom solutions
We often assist companies and organizations with custom development, and we use PowerShell for various services, such as creation and modification of site collections, lists, site pages, permissions, folder structures, content types and workflows. We have also helped customers to make a structured migration from file servers to SharePoint.

I am displaying the demo here, but I recommend you to visit the kalmstrom.com Tips section and read the whole article.


Peter Kalmström
CEO and Systems Designer
kalmstrom.com Business Solutions

No comments:

Post a Comment