RSS

Category Archives: Powershell

PowerShell – Using PowerShell 5 to automate the installation of your favorite Windows applications

In this blog post I will explain why to automate installations of Windows applications and how you can do this.

Why automate the installation of applications?

But first, why is this useful? Well this depends on your situation and there are probably many good reasons. For me though, it basically boils down to this:

  1. I often reinstall my computers with new (preview) versions of Windows operating systems and having to install applications each time is a waste of time. Also sometimes you forget to install some things.
  2. On a regular basis, friends and family either want me to install or upgrade their PC and I want to provide them with a standard set of programs that most people need/want without having to spend a lot of time on it. By example virus scanner, burning program, media player, codecs, etc.
  3. I want to update existing installed applications to the latest (and hopefully more secure and feature packed) versions.
  4. When installing applications, there are often checkboxes enabled to install other applications (you generally don’t want to install). Automated solutions using packages generally prevent these additional unwanted applications from installing.

Which tools to use to automate the installation of applications?

Before PowerShell 5 preview was released, I used both Ninite and Chocolatey to perform to automate installations. They both have their advantages as described on this wiki page.

The PowerShell 5 preview version of OneGet installs and searches software from Chocolatey repositories, but support of additional repositories will come in subsequent versions.

How to automate the installation of applications using PowerShell 5 preview?

To automate the installation of applications a couple of things are required:

  1. You need to determine which applications you want to install automatically.
  2. You need to determine the package name that Chocolatey uses for this application. Options include:
    -Using a browser to browse the Chocolatey packages
    -Using PowerShell and a part of the name of the application you’re looking for. By example if you’re looking for Irfanview, use:
    Find-Package -Name “fan”
  3. Store the package names to install somewhere (e.g. in a .txt file on OneDrive for easy access). My .txt file by example includes:
    AdobeReader
    Directx
    ffdshow
    Flashplayerplugin
    GoogleChrome
    Imgburn
    IrfanView
    Javaruntime
    Keepassx
    Mp3tag
    mpc-hc
    PDFCreator
    Silverlight
    TeamViewer
    Totalcommander
    Winrar
    greenshot
  4. Use the Install-Package cmdlet to install all the packages whose name is in the file from step 3.
    Install-Package -Name (Get-Content C:\OneDrive\AppsToInstall.txt) -Confirm:$False
  5. Wait for the programs to install

My opinion

It’s great to be able to use PowerShell to install my list of favorite applications similar to like I did with Chocolatey and I’m also looking forward to see what benefits the additional repositories will bring in the future.

I did encounter some errors however while trying to install some applications like Firefox and dotnet3.5. But since it’s still a preview, this will probably be fixed.

For regular users, I think they are better off sticking to by example Ninite because they’re often afraid of anything that involves a CLI.

Blog posts by other people about OneGet

Some other people have also blogged about the OneGet module and have gone in more technical detail, so be sure to take a look at their posts as well:

More information about PowerShell 5 Preview including a download link

Windows Management Framework v5 preview, includes also Desired State Configuration (DSC) improvements and NetworkSwitch commandlets to manage network switches that pass the Certified for Windows Program. For more information including a download link, you can read the initial blog post. : Windows Management Framework V5 Preview

 

 

 

Tags: , , , , , , , ,

LazyWinAdmin – a great powershell script for more efficient Windows management

The last couple of months I’ve been playing around a lot with PowerShell and I’ve also been trying to make some nice GUI versions for my script using PowerShell Studio 2012 from Sapien Technologies Inc. While looking for more information how to best use PowerShell Studio 2012 I came across LazyWinAdmin.

LazyWinAdmin is a great tool created by Francois-Xavier C that will save you a lot of time. It provides you with most of the commonly used tools and commands in a very structured and easy to access way. In the picture below you can see what I mean.

For more info on the tool, take a look at the website and be sure to download and test it yourself.

If you want to take a look at other useful tools I’ve found in the past, take a look at my applications list.

 
 

Tags: , , , , , , , , , , , ,

Home LAB Setup guide – 07 Make your lab available over the internet

In the first part of this LAB setup guide, I described the hardware selection process.
In the second part, I described the hypervisor selection and installation.
In the third part, I described VM guest considerations and preparations.
In the fourth part, I described Configuring Server 2012 VM as DC with DNS and DHCP using PowerShell
In the fifth part, I described easily creating (many) proper AD users with PowerShell
In the sixth part, I described creating a local PowerShell v3 Help Repository with PowerShell

In this post I will describe how you can make your lab available over the internet.

When you’ve created your home LAB, you want to be able to use it anywhere. Depending on your situation, one of these options probably best meets your needs.

Examples include the use of:

  1. Remote desktop connection to your server
    + Easy to configure (enable on server and configure NAT forwarding if appropriate)
    - On many enterprise or public networks TCP3389 is blocked by the firewall.
    - Connects only to specific server. Even though you access the rest of the network from there.
  2. VPN connection to your network
    • Using your hardware router
      + Connection to network, not just a server.
      - No dependency on Windows Server
    • Using Windows Server 2008 / 2012
      + SSTP VPN (TCP443), is generally not blocked on enterprise/public networks.
      + Connection to network, not just a server.
      - Dependency on Windows server.
      - Requires more configuration.
      - The root CA certificate for the certification authority (CA) that issued the server authentication certificate needs to be into the store Local Computer\Trusted Root Certification Authorities. For a self-signed certificate, this means that you need to have local admin permissions to add it.Note: DirectAccess is a great feature, but it requires the client to be a member of the domain. And in my case this would limit where I can connect from, therefore I don’t plan to use it. For other situations it might be a better solution though.
  3. Using 3rd party tools like logmein, teamviewer or VNC
    + Connects only to specific computer.

Since I want to be able to connect from within enterprise environments as well, I chose to use SSTP VPN in Windows Server 2012. The basic steps you have to perform, include:

  1. On the server, you have to install and configure the VPN service.
  2. On the server or your own PKI, you would want create and install a machine certificate. You can create a Certificate Signing Request and request a 3rd party public certificate. Alternatively you can create a certificate using your own Certificate Authority, or you could create a self-signed certificate, For creating the self-signed certificate you can use the great PluralSight SelCert tool.
  3. On the client, you have to make sure the created certificate will be trusted. This means you have to add the certificate to local system\trusted root certificate authority if you’re using a self-signed certificate, which requires local administrator permissions on the client.
  4. On the client, you have to set-up the VPN connection to the server. Preferably you want to connect by DNS name. For your home lab you can also utilize dynamic DNS services like by example no-ip.com or alternative solutions.

For some more information, you can also take a look at this:

 

Tags: , , , , , , , , , , , , , , , , , , ,

PowerShell – Reverse strings and reverse file names

With PowerShell it is relatively easy to reverse a string:
$str = “gnirtsdesrever”
$str[-1..-($str.length)] -join “”

Some of you might ask: Why would anyone want to do this ? Well, since the start of the year Usenet DMCA takedowns have begun to occur automatically, very quickly and very often. This means many movies and TV series on Usenet / News Groups are being taken offline very quickly.

Counter measures to prevent takedowns by uploaders include:

  • The use of encrypted links to NZB files.
  • The use file names that make it harder to find copyrighted files.

As you can probably guess, some just reverse the file names. The PowerShell script I’ve created will automate reversing the file names for files in the specified folder that match the specified file name filter.

I hope it is useful for you as well.

PS: Someone else on usenet had the same idea as me and created a VBS that will add a right-click menu option to explorer. I’ve added this in the same location as my PowerShell script as well.

 

Tags: , , , , , , ,

PowerShell – Manage printers

At work a colleague of mine was looking to modify printer permissions on a Server 2008 R2 terminal server using PowerShell. And to be honest, it was more difficult to do than I had expected.

So naturally, I started looking if someone had already created a script for this same purpose and eventually I found this great script created by Vadims Podans:
PrinterUtils.ps1 / Functions for advanced printer management

By leveraging this script, permissions were easily modified by adding the following lines:
$name = “Printername”
Get-Printer “localhost” $name | Add-PrinterPermission “corp\Domain Users” 0 “print”
Get-Printer “localhost” $name | Remove-PrinterPermission “everyone”
Get-Printer “localhost” $name

My modified script can be found here: http://bjornhouben-web.sharepoint.com/Lists/Scripts/DispForm.aspx?ID=22

Be sure to check Vadims Podans website for other great resources: http://en-us.sysadmins.lv/

 

Tags: , , ,

VMware – PowerShell script to get (storage)vmotion history

Even though I’ve always liked VMWare vSphere, I thought the events and informational messages weren’t always as helpful as they could be.

One of the common things I want to know are the vmotions and storage vmotions that have taken place. Luc Dekens has created a great script that shows the (s)vmotions that have taken place including details about them.

Be sure to take a look at his website for the PowerShell / PowerCLI script including a detailed explanation:
http://www.lucd.info/2013/03/31/get-the-vmotionsvmotion-history/

 
 

Tags: , , , , , , , , ,

Milestone of 50.000+ views reached !!! Thanks everybody.

My blog reached 50.000+ views. Thanks everybody, this really exceeded my expectation and motivates me even more to keep going. Special thanks go out to my fellow bloggers in my blogroll and to those who shared my posts on Twitter, Facebook and other social networks.

Even though my blog exists since January 2012, I really started to blog actively around August and ever since I’ve tried to keep posting on a regular basis. At the start of 2013 I even intended to blog every day. I was able to keep it up for a short while, but it was just too time consuming. Now I try to blog something at least once every 5 days. The blog post count is now at 170.

Personally I think Microsoft is on the right track. I’m really looking forward to all new Microsoft product (preview) releases including Windows 8.1, Windows Server 2012 R2 and System Center 2012 R2 and you can expect some blog posts about this in the near future.

Popular posts

From the stats, it turned out these are the blog posts that are being viewed most, if you’ve missed any of them you might want to take a look at them:

Stats

For those interested in the view stats, here they are:

Views

Comments and suggestions

If you have suggestions about what I can do to improve, please let me know. Also if you’d like to see some things covered more or in more detail, just leave a comment.

 

Tags: , , , , , , , , , , , , , , ,

Summary of 2nd Dutch PowerShell User Group – DuPSUG meeting with additional resources

Future events

Before starting with my summary of 2nd DuPSUG meeting, I want to inform you about some future events first:

  • Dutch PowerShell User Group Meetings
    • To keep track of news, use the links  to LinkedIn, Facebook, Twitter and the RSS feed on the DUPSUG website.
    • In the future, the plan is to meet every June and November.
    • The next meeting will probably be at November 7th at VX Company.
    • The idea is that community members will also present their own experiences, use cases, scripts, tools, methods. If you want to do so, please contact the DUPSUG group.
      • Remko Weijnen | Blog | Twitter | LinkedIn might be one of the people presenting at a future DUPSUG meeting.
    • Jeff Wouters might be able to arrange one or more copies of the PowerShell Deep Dives book from Manning since he’s contributing to it. The book isn’t complete and released yet, but Manning has an Early Access Program which means that you will get access to the completed chapters now and will get the full version when it’s done. Until June 13 there’s even a promotion to get a 40%-50% discount and it also applies to other great PowerShell books.
  • Inter Access Microsoft Summer Summit (Hilversum, July 2nd 2013 17:30-22:00 CET)

This event

Last Thursday I attended the second Dutch Powershell User Group meeting in Hilversum hosted at Inter Access and sponsored by Sapien Technologies Inc.

Just like I mentioned in the summary of the first meeting there were manu interesting sessions that provided me with more insight and inspired me for practical uses. It was also great to discuss current developments with other knowledgeable and passionate people. The main differences with the previous meeting was that:

  • This meeting was completely in Dutch, while the previous one was completely in English. As such, the workshop descriptions were also in Dutch and you needed to bring your own laptop.
  • The format of this meeting was more of a workshop, while the previous one was mainly presentations.

Thanks go out to all attendees, especially those presenting, organizing and sponsoring the event. Special thanks to Daniel Bot for helping me fix a (stupid mistake in a) script I was working on :)

Goodies and giveaways

Workshops / presentations

And now on with the really interesting stuff, the sessions/workshops. Below are the sessions with some info about the speakers and their sessions. I also added notes I took and other information I looked up afterwards. If you come across any errors or have comments, please leave a reply so I can fix it.

Read the rest of this entry »

 

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

PowerShell – Video, presentation and script downloads from the PowerShell Summit 2013 North America

The PowerShell Summit took place in North America in April and many of the prominent PowerShell people were there. And from what I read there were a lot of great presentations.

The PowerShell Summit 2013 North America conference schedule can be found here. Thanks to Don Jones and PowerShell.org (most of) these sessions are available for download: http://powershell.org/wp/2013/04/22/summit-downloads/

Videos are available here:
http://powershell.org/wp/2013/05/07/powershell-summit-videos/

So even if you weren’t able to attend, you can still learn from their presentations. Or if you did attend, you can review them again.

 

Tags: , , , , , , , , , , , , ,

 
Follow

Get every new post delivered to your Inbox.

Join 740 other followers

%d bloggers like this: