GoLang starting getting creative

gisliProgrammingLeave a Comment

GoLang or Go is a programming language maintained by Google and was created by Robert Griesemer, Rob Pike and Ken Thompson who have done a great impact on the programming language usage in the world, such as C and Java.  Go was in fact a experiment at Google that somehow where able to create such an awesome programming language that they figured that they should just release it. Anyhow Go language does force programmers to behave in a logical way … Read More

Powershell Parallel Processing

gisliScriptingLeave a Comment

Parallel processing is where you can iterate more commands at the same time. In powershell you basically run through step by step procedure where you do something, but if you run parallel processing you can run more than one steps at a time. For instance if you are enumerating through multiple servers like doing a WMI query from servers, you would in fact run one server at a time, but if you use parallel processing you can run WMI query … Read More

Simpler techniques with Powershell

gisliScriptingLeave a Comment

There are ways to do write code in Powershell much simpler and of course if you have been using Powershell and you feel comfortable with these different types of commands, it could be little bit hard to learn a new ones that do the same, for instance if you are writing a foreach command then there are few ways to do it. Lets say that I have an array with a few cars and I want to iterate through the … Read More

Simple way to add class to Powershell

gisliScriptingLeave a Comment

Current version of Powershell allows you to add classes so you can manipulate the data when it has been added to the class. Here is a simple way to create a class, this contains only a small example code on how to do this View the code on Gist. There are alternative ways to do this such as using function and new psobjects but that might not be intended to do really professional code, so it would be a good … Read More

Pinging a User with Powershell

gisliScriptingLeave a Comment

I´m really not going to explain this much other than what this script does is basically few things. This script was created because one had asked that he wished that he could ping users like computers, I said I will create a script for that for him and here it is. Checks if the user exist in Active Directory if it does it continues Gathers all computers based on OSType Checks if the computer is online Gets events based on … Read More

WannaCry Powershell Detector

gisliScriptingLeave a Comment

As you may or may not know there is an outbreak going on with a Virus named WannaCry. There are some computers that are affected. I created a small script that checks for specific files, and if the powershell detects it, it sends an email and disables all the network cards. You can run this at startup by using GPO, so in the morning when users arrive in the office and start the computer the script will run. Here is … Read More

Create users using CSV and Powershell

gisliScriptingLeave a Comment

There have been a lot of questions on the internet about how to create users from csv so I wondered if I could just create a quick simple guide how to do this. First we need to decide what attributes we are going to implement into the CSV file, we need some required attributes such as First Name, Last Name, Display Name, Username and so on. You can run the following command to see what attributes you can add or … Read More

Linux Powershell

gisliScriptingLeave a Comment

As you may know that Microsoft has released Powershell on linux a few months ago but I have not been able to test it, so I decided to try it out. I installed Ubuntu 64bit 16.04 and tried to figure out how to install Powershell. I noticed that Microsoft has said that they have released Powershell for linux and mac but they did not mention that it was an alpha version. Anyways I ran the following command wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb chmod … Read More

Create a lottery game using Powershell

gisliScriptingLeave a Comment

I just wondered if it was possible to build a small game with powershell so I started to figure out what was the best possible game for this scenario, I thought that it would be best just to create a lottery game. You would select your numbers and each draw will be random. If you would get 100% in the numbers you would then receive congratulations sign. There are few variables to set, the application name, what is the maximum … Read More

Dynamic Infrastructure Documentation with Powershell – Part 3

gisliDocumentationLeave a Comment

Here we go again, in this part we are going to get all servers in Active Directory and then we are going to audit them for both applications and services. Note that the snippets in LinkedIn is not very code friendly so bare with me, I will post this blog also on my personal website that I am currently working on and it will have better code snippets. Create a new table in DynamicDocumentationDB named AuditServices this table will contain … Read More