Monthly Archives: July 2018

//July

Always check first

As a System Administrator I’m always looking for automation and easier or faster ways to do my job properly. When I’m creating scripts which involve of creating or checking if something exists it prevents errors in output and is a nicer and cleaner way to go about doing scripts, why would you want to create something exists anyways? Writing scripts or snippets I use the command Test-Path combined with an if statement and it depends what I want to do if I’m going to use the negative “NOT”, let me give you an example.
$path = "C:\temp"
if(Test-Path -Path $path) {
 Write-Host "The path `"$path`" already exists"
} else {
 New-Item -Path $path -ItemType Directory
}
(more…)
By |2018-08-03T00:44:33+00:00July 23rd, 2018|Common, File|0 Comments

First post

Welcome and thank you for visiting my first attempt to blog. I’m a Powershell script enthusiast and would like to share my experience and script snippets with you, get comments on how to improve and help others who want to use my scripts. Feel free to contact me if you have any questions, requests or you simply want to chat. My contact info is here Email: halli@powershell.is Facebook: https://www.facebook.com/hallgrimur LinkedIn: https://www.linkedin.com/in/hallgrimurf Slack: https://powershellis.slack.com Hope I’ll hear from any of you and hopefully you can enjoy or even use some of my snippets. Hallgrimur #TheMachine
By |2018-08-02T11:05:22+00:00July 20th, 2018|Common|0 Comments