Writing code is a creative endeavor. Just like art, being creative however doesn’t always mean “good.” It’s possible to spend days working on a PowerShell project, see that it solves the problem it was created to solve yet breaks the moment a single line is changed. Even though you can write code a particular way doesn’t mean you should. Luckily, [...]
The post How To Use PSScriptAnalyzer To Analyze Your Powershell Scripts appeared first on Adam, the Automator.
Модуль PowerShellGet — очень удобная вещь. Мы можем легко находить, устанавливать и обновлять модули из PowerShell Gallery и других зарегистрированных репозиториев при помощи командлетов Find-Module, Install-Module и Update-Module. Однако, вследствие того факта, что PowerShell 5.0 и выше теперь поддерживает возможность присутствия в системе нескольких версий модулей одновременно (что само по
Psake, pronounced sah-ki, is an automation tool that allows anyone to create software build scripts in PowerShell. DevOps is a hot topic these days. As such, many traditional operations folks find themselves thrust into many traditional developer-focused roles like deploying custom software through a build process. This has led ops guys and gals to adapt their existing knowledge to software [...]
The post Psake: Build Automation With Powershell appeared first on Adam, the Automator.
The days of using ping.exe to see if a host is up or down are over. Your network probably shouldn’t allow ICMP to just fly around unaddressed, and your hosts probably shouldn’t return ICMP echo request (ping)Read More...
The Posh-SYSLOG module has been very popular since its first release in 2013. SYLOG provides a common integration point into enterprise monitoring, alerting and security systems and administrators and developers often need to push messages from their scripts and automation activities to a SYSLOG server.
There are two common pieces of feedback, TCP support and improving the performance. I am excited to announce a new version of POSH-SYSLOG, which introduces TCP support and a number of performance improvements.
One aspect of writing great code is ensuring the input your script receives is as you’d expect. It’s best to limit the scope of input. This limits the possibilities that you’ll have to account for later on in the code. Writing good validation routine is an important skill to learn, and when PowerShell gives us the opportunity to do this [...]
The post Building Better Powershell Parameter Validation appeared first on Adam, the Automator.
When working with PowerShell, there are times when we need to work with sets of data. Normally, when working with objects in PowerShell, we’re not just limited to only single objects. We work with lots of files, user accounts, virtual machines, and so on. When we display these various objects in the console, by default, the objects will just scroll [...]
The post The PowerShell Group-Object Cmdlet appeared first on Adam, the Automator.
You probably know PowerShell is all about objects. Objects are what make PowerShell great! By nature, all objects have properties, and we can read those properties by various means. The native objects we get back from commands like Get-Process, Get-Service, and a plethora of other commands are usually just fine. But sometimes the properties returned on an object need to [...]
The post Add a Calculated Property with Select-Object in PowerShell appeared first on Adam, the Automator.
As we all try to do more with less with automation, we sometimes get to a point to where we’ve got a new problem. We’re now running so many scripts and processes that, in the end, we’re not sure what “done” looks like. If we’re running a user provisioning script that creates an AD (Active Directory) user, an Exchange mailbox, [...]
The post What Is Infrastructure Testing? appeared first on Adam, the Automator.
On Friday 22nd September a group of people involved with organising PowerShell User Group events around the UK will be hosting a 1 day PowerShell conference in London, PSDayUK. It will take place following on from the 2 day WinOps conference at the same venue, Skills Matter CodeNode, on Wed 20 – Thr 21st September. … Continue reading PSDayUK September 2017 →
It was back in 2003-04 when I had worked on linux with RedHat 2x & 3x, Fedora 2x and Knoppix 3x. After that for almost a decade I didn’t use linux. In last few years (since late 2014) I have been playing Ubuntu releases as part of my experiments, learning DevOps tools and data science […]
This week I was invited to speak at the joint WinOps London and London PowerShell user group meetup in central London. For more information about the event you can have a look at the following link: WinOps #14 – in connection with PowerShell London UK Our July meetup will be held at Rubrik’s offices in Moorgate […]
Snowball Edge is Amazon’s answer to customers’ complaints about the lack of support for on-premise data management use cases where the cloud networks are limited by the data bandwidth and geography. Snowball Edge is an update to the popular Snowball storage container program. It’s Amazon’s answer to customers’ complaints about the lack of support for on-premise data management use cases [.
One of the features of PowerShell that left many people wondering why it wasn’t included earlier was local account management. Every Windows system has local accounts and being able to add, remove and modify these local accounts is a routine task across system administrators. Before PowerShell v5, the community was forced to step in and create their own ways to [...]
The post Working with the LocalAccounts Cmdlets in PowerShell v5 appeared first on Adam, the Automator.
Recently, fellow Microsoft MVP Mickey Gousset asked me how to remove existing user defined variables from the PowerShell ISE (Integrated Scripting Environment) before running a script a second time without having to restart the ISE. While you could keep track of the variables you’ve used within your script to remove them once the script completes with the Remove-Variable cmdlet or by deleting them from the variable PSDrive, that can be a less than desirable solution for long and complicated scripts that define lots of variables.
In this article we will look at how the PowerShell Desired State Configuration (DSC) feature in Windows PowerShell can be leveraged for building lab environments.
If you are unfamiliar with DSC, have a look at the DSC overview page on MSDN. As stated there:
DSC provides a set of Windows PowerShell language extensions, new Windows PowerShell cmdlets, and resources that you can use to declaratively specify how you want your software environment to be configured.
Deploying software doesn’t have to be expensive or complicated if you use Windows PowerShell properly. Deploying software to endpoints is a like that whack-a-mole game. The moment an IT administrator does the research, creates the package, distributes the software to machines and gets it installed is the time to do it all over again. Software is continually being updated especially [...]
The post How To Deploy Software On The Cheap With Powershell appeared first on Adam, the Automator.
The process is similar to creating any plain text file in PowerShell — but with a few twists. Storing data in a structured way is important when that data will be read by a computer. One of the easiest ways to put data into an easy-to-read format is with a comma-separated value (CSV) file. A CSV file can just be [...]
The post How to Create CSV Files with PowerShell appeared first on Adam, the Automator.
Wer Zugang zu einem SQL Server hat, sollte diesen auch nutzen. Bei der Arbeit mit PowerShell werden oft Listen oder Tabellen genutzt. Diese Informationen werden nicht selten in csv Dokumenten gespeichert. Mich stört daran, dass solche Tabellen nicht weniger werden … Weiterlesen →
Whether you like it or not, at some point in your career you will be working with IPs.
I recently ran into a challenge at work with variable length subnet masks that inspired this post.
I needed to brush off some old networking skills and got to play with a little PowerShell along the way.
With that in mind, let’s get into it.
The Good Stuff:
A couple of tricks to make working with IPs a little less painful.
As referenced in my blog article from yesterday, I’ll be presenting a PowerShell 101 session at SQL Saturday Atlanta tomorrow morning (July 15, 2017). While I plan to cover the basics of PowerShell, I also plan to show you what you can do with PowerShell without having to write very much code at all. I’ll be killing it in my session with live demos including this one that I’ve made a video of as a sneak preview.
If you’re interested in some free PowerShell training where you’ll learn the basics of PowerShell from a best practices standpoint, I’ll be presenting a session on “PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell” at SQL Saturday #652 in Atlanta, Georgia this Saturday, July 15th. My presentation begins at 8am eastern time and is a beginner level session.
As you may or may not know, I recently decommissioned my old Dell PowerEdge 1950 server that I used for a few Lab virtual machines. While experimenting with PowerShell on these Virtual Machines, I have found myself in the situation where it would be easier to delete the Virtual Machines
Most of the time, a PowerShell cmdlet will return all the information you need to work with it later in the pipeline. Sometimes, though, there’s some assembly required. What I mean, is maybe the cmdlet returned theRead More...
Storing a password in an encrypted file for use by the same user on the same computer using PowerShell is fairly easy, but storing a password in an encrypted file for use on another computer or by another user is a bit more challenging. It requires the use of a key file and of course if someone else can read the key file, then they also can decrypt the password. In my scenario, I work in a VDI (Virtual Desktop Infrastructure) environment that doesn’t use persistent desktops and I need to have a certificate available to decrypt emails from certain individuals.
Introduction: Yesterday while troubleshooting a network issue, I realized that if I can know the vendor of a MAC Address, then I could understand if it’s a Dell Router, a VMWare virtual NIC or a Dell server then maybe it will make life a bit easy, like in the following example. The Idea and Making it work:… Read More Get-MACVendor using Powershell
There’s lots of fun things you can do with datetime objects in PowerShell, and using the Get-Date cmdlet. Here’s one of them. Say you want to know what day of the week it will be some arbitraryRead More...
Dates are hard, that makes scheduling hard.
Ever had someone tell you to be ready on the first Monday of the month?
Don’t forget patches come out on the second Tuesday.
My personal favorite is the fourth Thursday in November (Thanksgiving here in the states).
While these types of dates are easy to remember, they can be hard to build automation around.
Don’t worry with a couple of tricks and my helper function, I’ll make sure you never miss Mother’s Day again (second Sunday in May).
I’ll be speaking at Live! 360 Orlando, November 12-17. Surrounded by your fellow industry professionals, Live! 360 provides you with immediately usable training and education that will keep you relevant in the workforce.
I’ll be presenting the following session:
Keep Up with NOW! Automate Rebuilding Your (Home) Lab On Steroids
SPECIAL OFFER: As a speaker, I can extend $500 savings on the 5-day package.
In this article, we are going to introduce a new PowerShell module called Data Protection Manager Community Extensions. Before we get started, let us have a quick overview of what products the module support.
System Center Data Protection Manager (DPM) is an enterprise backup system which provides functionality to back up data from a source location to a target location connected to the DPM server.
I’m honored and humbled to have been awarded the Microsoft MVP award for a fourth consecutive year. I received email notification yesterday confirming that I’ve been renewed for another year. The first two Microsoft MVP awards that I received were for PowerShell and due to changes to Microsoft’s MVP award program, the latest two have been for Cloud and Datacenter Management, although my focus is still PowerShell.
Recently, I had the need to pull out all of the hyperlinks from an excel worksheet that was given to me. While I could have gone the manual approach by looking through all of the cells in the worksheet and … Continue reading →
In order to write less code or to write better one-liners in Powershell, I often find one of these techniques useful, and let me know if you feel the same. Using -OutVariable parameter Variable squeezing Its a shame many of us ( including myself 😉 ) were not aware of this for quite long. Using Tee-Object Cmdlet… Read More 3 ways to Store & Display results in/from a Powershell variable a
This past weekend while at SQL Saturday Chattanooga, I was asked if it was possible to have the PowerShell ISE (Integrated Scripting Environment) automatically open with a right/left split pane: Instead of the top/bottom default split pane: One thing to note is that by default the PowerShell ISE will reopen in whatever configuration you close it in, which could be either of the ones previously shown or the full screen editor.
This is why I Love PowerShell… It’s simple, yet functional. From an Administrative perspective, I think we can all agree that any changes in your Domain Admins group without your knowledge would be of interest to you. If you’re in a large organization with access to enterprise management tools you
Last week, I put out a post about using Select-Object to explore PowerShell objects. This week, I am going to quickly cover using Get-Member to do the same. Let’s say you’re using Get-CimInstance to get information about theRead More...
If you are reading this you must have used Select-object in PowerShell to select properties of an object something like Or, Where-Object cmdlet to filter out values on any specific object property like All these work well when you know the Property Name you are searching. But what if you don’t know the property name and… Read More Selecting Objects by value in Powershell
Существующие репозитории чаще всего используются в двух случаях: для начала разработки своего проекта, причем не с нуля, а с использованием чьего-либо кода (Open Source!) или же для того, чтобы предложить внесение изменений в чей-либо уже существующий код. При этом во втором случае предполагается, что все изменения вы вносите в свой репозиторий, а к принятию их […]
Maybe it’s my liberal arts background but I love words and word games. I have a constant pile of crosswords and enjoy tormenting my kids (and wife) with puns. I am also fascinated with word hacks like palindromes and anagrams. An anagram is where you take a word like ‘pot’ and rearrange the letters to […]
Today we are going to use inheritance to create multiple DSC resource from a base class.
I’m the first to admit I’m lazy and always trying to get the most bang for my lines of code.
Inheritance is a great way to reduce code duplication and pretty easy once you wrap your head around it.
The Good Stuff:
My DSC FileWatcher module and an example of building resources with inheritance.
I’m going to be building off my SmartServiceRestart resource from this post.
If you’re interested in some free PowerShell training, I’ll be presenting a session on “PowerShell Non-Monolithic Script Module Design” at SQL Saturday #624 in Chattanooga, Tennessee this Saturday, June 24th. My presentation begins at 1:15pm eastern time and is an intermediate level session. There’s also a PowerShell precon on Friday being presented by Microsoft MVP Aaron Nelson (the precon is not free) and a PowerShell DSC (Desired State Configuration) session on Saturday being presented by Microsoft MVP Tim Warner.
Today I received an invitation to preview PowerShell in Azure Cloud Shell (PSCloudShell). Azure Cloud Shell is a new feature added to Azure earlier this year which allowed us to run a Bash console inside our web browser to manage our Azure resources. Microsoft has just added PowerShell to this as well and I’m already having a blast poking around to see how this works and imagining all the possibilities.
When you’re first getting started with PowerShell, you may not be aware that sometimes when you run a command to get data, the information returned to the screen is not ALL the information that the commandRead More...
Если вы часто используете командлет Copy-Item в скриптах или интерактивно, то вы могли заметить, что результат его работы, в части того, как в итоге будут расположены копируемые элементы, в некоторой степени непредсказуем. Тем не менее, логика здесь есть, и зависит она от существования элемента, указанного в параметре -Destination. Выражается это в следующем: если элемент, указанный […]
When you hit F7 in PowerShell console it brings up a command history dialog box where you can choose and run history items like in the following image But this feature doesn’t work in Powershell ISE or any other script editor. Well to the rescue following is a quick function which uses Out-GridView cmdlet to mimic… Read More Powershell Get-History+
Продолжим начатую в предыдущем посте тему и рассмотрим еще несколько полезных сочетаний клавиш в Visual Studio Code. Folding Что такое Folding? Это возможность свертывать части кода для того, чтобы он не загромождал имеющееся пространство редактора. В разных средах разработки это реализовано по-разному. Тот вариант, что используется в Visual Studio Code — это так называемый language-unaware
This is the fourth and final part of a short series of posts about things I discovered by reading the excellent Learn PowerShell in a Month of Lunches book (recently released in 3rd edition) as a not quite beginner.
This post focuses on things I learnt about PowerShell jobs, which