Easy Transfer of Files from Vmware Prod to a Disconnected Test VLAN

Here’s a script I put together out of a frustration of getting files to a test environment. We have a VMware test environment that’s segmented off into a test VLAN that no production VLAN can get to. I’m constantly needing to copy files from production over to the test environment. Previously, I was having to create a folder on my workstation, create an ISO from that folder’s contents, open up the VMware vSphere client, attach that ISO to the VM I wanted, get to the console of the VM and then copy the files from the CD drive. PITA! I’m no VMware expert but I was told the only other way to do this was to create a VM “mule” which is a VM with a production NIC and a test NIC on it. I’d then copy files from production to this VM and then copy the files to my […]

Read more

Get TCP/UDP Connection Count

Here’s a simple situation I ran into today. I’ve been troubleshooting an intermittent problem with a Windows 2008 R2 server for a few weeks now. I opened a Microsoft support ticket and the problem was believed to be due to port exhaustion in the dynamic port range. I confirmed the max ports were at 16,184 which was the default at the command prompt. netsh int ipv4 show dynamicport tcp netsh int ipv4 show dynamicport udp I then needed a quick way to test this so I came up with this simple script. I had to use the CLI utility netstat because this server does not have Powershell v4 on it else I would have used Get-NetTCPConnection. I figured I’d share to save someone a little bit of time figuring out how to get the TCP/UDP connection count on a remote server.

Read more

How to Create a Robust ConfigMgr Backup with Powershell

Download this script on the Technet Script Repository I’ve recently completed a high priority task on my list this week created from my most recent forced ConfigMgr site restore.  After that went down, I’d been procrastinating getting a solid ConfigMgr site backup going again. Previously, I was using the afterbackup.bat file to do some post-backup tasks doing a combination of SSRS backups and daily folders. It was working great although being a batch file it was pretty rudimentary. I’m not doing this anymore because during my outage, I discovered that the afterbackup.bat file was removed and I had no backup whatsoever. Awesome, right?!? I decided to write a Powershell script that did all that batch file did with the robustness that Powershell can provide like error handling and verification. Previously, I was limited to well…uh…a batch file but now I see a whole new light. Any good ConfigMgr admin knows […]

Read more

How to Survive a Problem That Won’t Sit Still

I recently was faced with a problem that most IT pros can relate to and thought I’d share. I’ve been working on an obscure Active Directory secure channel problem on a production server where it will intermittently decided to lose its domain trust. It’s one of those problems that come and go. To make matters worse, it’s the kind of problem that when it breaks all hell breaks loose but it’s not broken all the time. No one knows when it’s going to break and the only way to do a temporary “fix” is to reboot it. However, you no longer have a problem to troubleshoot. I’m now in a constant battle with users. They won’t let me leave it broke for any period of time yet they want the problem fixed. Something that seems so obvious to me such as some short-term pain (leaving it broke) for long-term gain […]

Read more

Using Automation Module PSModulePath in Times of Extreme Laziness

How to Use PSModulePath as an Automation Module? In order to get automation module importing working, the file system path must be added to the  PSModulePath  value in the  HKLM:\Software\Microsoft\Control\Session Manager\Environment  registry key. I have a few places where I have modules kept and I kept have to go into the registry value and manually change it to add my new directory. No more! I must do this automagically so I created a tiny module made up of 3 functions; Get-PSModulePath  Get-PSModulePath ,  Remove-PSModulePath  and Add-PSModulePath . I bet you can guess what they all do. If you’d like to save a few minutes a year, feel free to download and import this module called PSModulePath in my Github repo.

Read more

Easy Azure VM Snapshots with Powershell

I’m just getting started learning Microsoft’s Azure cloud service and was disappointed to find out that an easy way to take and revert snapshot wasn’t there. After Googling for a bit I discovered that a similar functionality exists called blob copying. Using blob copying, you can essentially do the same thing as a snapshot which saves the state of a disk at a moment in time. After a few hours of tinkering around with the code in Keith Mayers’ Scripting Guys post I was able to come up with a robust, working solution. I’ve included here both my Create-AzureVmSnapshot and Restore-AzureVmSnapshot scripts. I’ve successfully copied and restored a single Azure VM of mine but please do your own testing before you use these scripts religiously. Download the create snapshot script on the Technet Script Repository Download the restore snapshot script on the Technet Script Repository

Read more

Convert ConfigMgr Application to Package

UPDATE 07/11/14 – Added the ability to convert applications with multiple deployment types. The script will now create a package for each deployment type. UPDATE 08/28/14 – Added the ability to distribute content of the package to the same DPs/DP Groups that the application’s content was a part of. Here’s a script I recently wrote to solve a necessary problem. At my client, we were seeing way too many flaky problems with using application inside OSD task sequences. The same programs would work just fine in a package. It was decided that no more applications would go inside OSD task sequences. This is a script I wrote based on David O’Brien’s script. to not only convert all of the existing applications but also to use in a larger application provisioning script that creates an application and immediately converts it to a package for OSD. Download this script on the Technet […]

Read more

CMClient Module: Invoke Common ConfigMgr Client Actions via Powershell

UPDATE 06/13/14 – Added Enable/Disable-CMClientDebugLogging functions. I’m pleased to share my most recent module; CMClient! This module contains a lot of the common actions I tend to do on ConfigMgr clients all grouped into a module. At this point, it only has functions to kick off common client triggers. These triggers are Machine Policy Download, Discovery Data Cycle, Compliance Evaluation, Application Deployment Evaluation, Hardware Inventory, Software Inventory, Update Deployment Evaluation and Update Scan. Each of these functions is simply an easy way to trigger client schedule IDs. Each function feeds back to the the function that’s doing the work; Invoke-CMClientAction. If you specify -AsJob on any function, that gets passed to the Initialize-CMClientJob. I’ve tested these functions on nearly all of my 5,000 clients so far so I believe it’s fairly bug-free. If you notice any problems, please let me know. I intend to be adding a lot more functions […]

Read more

Get-UpTime: A Handy Little Script for Remote Systems

One of the pieces of information I’m constantly needing is to know how long a server or user’s workstation has been up for. Using WMI and the LastBootupTime attribute makes this pretty easy! Introducing Get-Uptime! This is a simple, little script I use all the time. In fact I typically make this a function in a module. It’s great for when you’re in the console and want to check uptime real quick on a remote system.

Download this script on the Technet Script Repository

Read more

A Little Code Change Makes a HUGE Difference

I was tinkering around with a script the other day and came across a requirement I have in nearly every script. The requirement was to iterate through a collection of objects, do something to each of the object’s properties in the fastest, most efficient way possible and eventually get a collection of strings as output. I started out just throwing in my usual method of doing this via Select-Object’s calculated properties and I got to thinking if there’s a better way. Usually, I have less than a few thousand objects to iterate through but what if I had millions? Using a calculated field surely can’t be the best way, can it? I set out to find the truth. I decided to post up a Powershell.org forum thread entitled Is there a better way to expand a calculated field? that raised the question to others and I got a few interesting […]

Read more
1 22 23 24 25 26 28