PowerShell

admin on April 21st, 2016

THANK YOU! For attending my session on SQL and PowerShell. Full democode can be downloaded SQL Server and PowerShell. Any questions? Let me know: @DimensionIT Dimitri Koens on LinkedIn dimitrikoens at gmail dot com Don’t forget to rate with the Whova App. Thnx! — Dimitri

Continue reading about SQL Server and PowerShell

Dimitri Koens on June 21st, 2013

With PowerShell you can kill a process with the Stop-Process cmdlet. While the Get-Process cmdlet let’s you get a listing of processes from a remote machine, sadly Stop-Process doesn’t allow you to connect to a remote machine. Most possibilities in PowerShell are just .NET and WMI monikers. So as soon as PowerShell doesn’t allow me […]

Continue reading about Kill a process remotely (the SCOM Console in this case)

Dimitri Koens on June 20th, 2013

Here’s a PowerShell script that allows you to monitor processes on the local or a remote PC. It’s based on the Get-Process cmdlet. It loops every secon, compares changes in the process list and displays them nicely on the screen. It shows a green line when a new process runs and a yellow line when […]

Continue reading about Monitor processes on a local or remote PC

Recently, I was wondering how much code I would need to do basic hardware and software inventory on several remote systems. After experimenting a little bit I came up with the following line of code: Get-Content pcs.txt | foreach { Write-Host $_ -f Green; $pc=$_; Get-Content wmi.txt | foreach { Get-WmiObject $_ -ComputerName $pc } […]

Continue reading about Hardware and software inventory using one line of code (only 60 characters)

Dimitri Koens on October 22nd, 2012

Today I published an update to my PowerShell Quick Reference: it’s now updated to PowerShell v3. I tried to include most notable new features of PowerShell v3 in the limited space of my Quick Reference. I really try to keep it a 2-page Quick Ref. It contains a complete new section on PowerShell v3 technology, […]

Continue reading about New version of PowerShell Quick Reference!

Dimitri Koens on October 2nd, 2012

PowerShell 3 has launched! Since september 4th you can download the final (RTM) release of PowerShell 3 from this link: http://www.microsoft.com/en-us/download/details.aspx?id=34595 Some of the best new features include: Automatic module loading, no more “import-module” required Lot’s of extra modules like DHCP, DNS, iSCSI, NetAdapter, NetTCPIP, Printing, ScheduledTasks, SMB, and many others. Few syntax changes. Get-Process […]

Continue reading about PowerShell 3 launched!

Dimitri Koens on February 15th, 2012

When you’re using the PowerShell module for Hyper-V from James O’Neill (a.k.a. jamesone) then you’ll find out that many cmdlets don’t accept string collections as variable. Here’s an example: Import-Module c:\psmodules\HyperV\HyperV.psd1 $Hosts = “HV01,HV02,HV03,HV04” Stop-VM -VM VM03 -Server $HostsString -Force Throws this error: Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) At c:\psmodules\HyperV\VM.ps1:73 […]

Continue reading about Strange behavior with Hyper-V module from Codeplex

Dimitri Koens on December 6th, 2011

With the built-in Best Practices Analyzer we can run several tests and implement any out comings. The BPA is incorporated in the Windows Operating System since Windows Server 2008. With PowerShell we can run a BPA-scan, store it as a baseline and compare it with our current situation. Here is a PowerShell script to establish the […]

Continue reading about Compare your baseline using Best Practices Analyzer and PowerShell

Dimitri Koens on November 17th, 2011

There are some situations where you want to boot a remote computer that’s powered off, but don’t have the tools to do that. For example: Microsoft SCCM allows you to boot a remote computer (wake it up from power off) to install Windows Updates. If you don’t have SCCM, there are hundreds of alternative software […]

Continue reading about Wake on LAN (WOL) using PowerShell

Dimitri Koens on November 16th, 2011

PowerShell provides some commands to manipulate services, but that doesn’t work on remote computers! The script you can find below demonstrates that stopping a service on a remote computer using Stop-Service is not working. First I verify that the MSDTC service is running on the local machine and a remote machine: server2. If I want […]

Continue reading about Stop a remote service using PowerShell

Dimitri Koens on November 15th, 2011

It’s possible to compress a folder or file since Windows NT. It’s a feature of the NTFS-filesystem. Normally we would do that on the properties of the folder or file in the Windows Explorer, but you can do this with PowerShell too! Just use this command: Invoke-WmiMethod -Path “Win32_Directory.Name=’C:\Test'” -Name compress And to Uncompress the […]

Continue reading about Compress a folder or file using PowerShell

Dimitri Koens on November 13th, 2011

The other day I stumbled upon a nice PowerShell command to use the speech API found on modern Windows Operating Systems. With this script PowerShell can talk to you! Great for situations where you want to hear about the progress of your script. Or maybe to tell you there’s an alert instead of showing the […]

Continue reading about PowerShell speaks!

Dimitri Koens on November 10th, 2011

Not too long ago I migrated my e-mail, calendar and contacts to the cloud. The migration was very smooth except for one thing. For some unknown reason a reminder was added to all my all-day appointments. I use these appointments for birthdays and that sort of events. I never use a reminder on my all-day […]

Continue reading about Retreive all-day appointments in Outlook with PowerShell

One of my clients asked me how to check for expired certificates. This simple script opens the certificate store through the PS-drive CERT: and lists all certificates that are soon to expire. You can change the threshold to any value in the first line. Here’s the script: $threshold = 30 #Number of days to look […]

Continue reading about Check for certificate expiration with PowerShell (on multiple servers)

Dimitri Koens on October 19th, 2011

Hi All, Celebrating my first post on my new web site, let’s provide you with my ultimate PowerShell Quick Reference! I just finished work on my latest version of the PowerShell Quick Reference. You can grab a copy and use it as a reference when creating your PowerShell scripts. The document contains a lot of […]

Continue reading about PowerShell Quick Reference