Link to home
Create AccountLog in
Avatar of janhoedt
janhoedt

asked on

Powershell: modules, snapp-ins load in profile, what profile do you have?

Hi,

So now I know how to create a profile: http://technet.microsoft.com/en-us/library/ff461033.aspx but what to put in it besides  set-executionpolicy bypass?

In other words, if I want to load specific modules, I need to download them, install them and then what? Put into profile to load them each time?

What kind of profile do you have?
J.
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Mine does the following:

1. Updates a bunch of modules I write from the source for those
2. Loads a small collection of named modules ("Import-Module x, y, z" rather than "Get-Module -ListAvailable | Import-Module)
3. Loads a very small number of named snap-ins
4. Dot-sources a small collection of scripts (things that aren't worth making into modules)
5. Makes the console transparent (because I like that) using an old piece of code Joel Bennett wrote (I can't find the source for that any more).

There is little point in changing the execution policy in the script. If you don't sign your profile script it'll refuse to execute when anything restrictive is in use.

Some of that loading goes away with PowerShell 3 since it can autoload CmdLets from modules. I suspect that will simplify your use case.

Chris
Avatar of janhoedt
janhoedt

ASKER

Ok, thanks a lot. That gives me just an idea of what you run.
I'd like to have some examples in order to get started with Powershell correctly.

What I'd like to do is:
*interrogate AD with Powershell in an administrative way
* remotely execute commands to an SCCM 2012 server: create collections, create folders, move folders, create membership of collections.
First line by line, then putting scripts together in 1 big script for automating installations.

Installed Powershell 3. How to load automatically there then?
Any input is welcome.
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer