Category Archives: PowerShell

PS ISE – Measure Script speed

Quick and easy way to measure execution time on a script, add the following to Microsoft.PowerShellISE_profile.ps1 Then, restart ISE and now you can Add-ons you will have a new menu item. ๐Ÿ™‚

Posted in PowerShell | Comments Off on PS ISE – Measure Script speed

Silent patching and controlled reboots

Patching silently and installing applications without any user interaction… This is really hard to do and it’s really hard to get compliant machines if you do not force a reboot every now and then. Then, if you force the user … Continue reading

Posted in ConfigMgr, Good-to-have, PowerShell | 5 Comments

Merry Instagram Christmas

OK, this post might be a bit late… But if you have a Instagramoholic friend that you don’t know what to give for christmas, this might be the thing. ๐Ÿ™‚ Running this will output an image of all (Well, a … Continue reading

Posted in PowerShell | Tagged , , , | Comments Off on Merry Instagram Christmas

Migrate printers to new server

If you move printers from one server to another the users needs to reconnect all printers… And… of course it’s easy to do with a small Powershell script. ๐Ÿ™‚ Example usage

Posted in PowerShell | Comments Off on Migrate printers to new server

Copy drivers from one boot image to another

When you have a new ConfigMgr boot image ready but are missing some drivers from an old one… might be hard to find them in a larger structure. … Powershell to the rescue! ๐Ÿ™‚

Posted in ConfigMgr, PowerShell | Comments Off on Copy drivers from one boot image to another

Find undefiened networks in netlogon.log

To find undefined networks in your AD you can parse the netlgon.log files on the domain controllers. (This script will gather all errors you can of add some “If ($_.Error -like ‘NO_CLIENT_SITE*’) …” if you only want that kind of … Continue reading

Posted in Active Directory, PowerShell | Comments Off on Find undefiened networks in netlogon.log

Remove old logfiles

Want to clean out old logfiles from IIS (or other products)?

Posted in PowerShell | Tagged , | Comments Off on Remove old logfiles

Get Powershell ISE to run scripts with -Verbose flag

Missing an easy way to run your scripts from ISE with the -Verbose or -Debug flag? Easy to add… Open up your Microsoft.PowerShellISE_profile.ps1 file and add the following lines: Now when you restart ISE you should see the options under … Continue reading

Posted in ISE, PowerShell | Tagged , | Comments Off on Get Powershell ISE to run scripts with -Verbose flag

Create Site Roles Collections

Quick and easy way to create device collections based on site roles: You will end up with collections like: – ConfigMgr-Role SMS Distribution Point – ConfigMgr-Role SMS Device Management Point – ConfigMgr-Role … and so on …

Posted in ConfigMgr, PowerShell | Comments Off on Create Site Roles Collections

Get filename in ConfigMgr 2012 ContentLib

In ConfigMgr 2007 it was kind of convinient to be able to edit files directly on a DP, in ConfigMgr 2012 that isn’t to easy if you are using Content Library. There are a few ways to find out where … Continue reading

Posted in ConfigMgr, PowerShell | Comments Off on Get filename in ConfigMgr 2012 ContentLib

Get-ADSites and create Site Based Collections

Missing an easy way to get AD-Sites from Powershell? They are listed under Sistes/Configuration with the objectClass = Site. So a simple LDAP-query does the trick. Then, with these sites it’s easy to create Device Collections in ConfigMgr based on … Continue reading

Posted in Active Directory, ConfigMgr, PowerShell | Comments Off on Get-ADSites and create Site Based Collections

Reset local admin password

You probably want to have random passwords on all your local admin accounts… Wrote a function that generates a complex (and readable) password and another function that sets the local admin password. This is how to reset password on a … Continue reading

Posted in PowerShell | Tagged , , | Comments Off on Reset local admin password

Remove all direct memberships from collections

If you are using direct memberships to speed up ConfigMgr, you probably want to clean it up when your collection query is good to go… The problem is to find all direct memberships since Get-CMUserCollectionDirectMembershipRule doesn’t allow wildcards. But there … Continue reading

Posted in ConfigMgr, PowerShell | Comments Off on Remove all direct memberships from collections

Default Powershell Execution Policy

You can use a GPO to set the ExecutionPolicy to a static value on all machines. But what if you want to default it to something and then let the users have the ability to change it? Group Policy Preferences … Continue reading

Posted in PowerShell, Snowland.se | Tagged , , , | Comments Off on Default Powershell Execution Policy

Calendar in Powershell CLI

Working on a nice way of creating informational background images… Stay tuned, it might be more posts on that later on… ๐Ÿ™‚ Anyway, started with a small snippet that creates a calendar in CLI Will return something like this:

Posted in PowerShell | Comments Off on Calendar in Powershell CLI