posted
02/03/10
By Fredrik Wall
Snart är det dax för TechDays i Örebro.
Jag kommer att vara där och representera Scandinavian Powershell User Group vid användargruppernas monter.
Alla som ska dit är välkommna att komma till montern och snacka med mig.
Är det något speciellt som ni skulle vilja att jag tog fram till TechDays som rör PoweShell så säg till.
Jag kommer att ha med mig PowerShell Guru kepsarna som vart en hit förra året. Har ett gäng kvar!
posted
02/03/10
By Fredrik Wall
I have just found My favorit iPhone app.
iPowershell fr.o.m. Sapien. It’s à powershell referenser library. Very nice!



posted
17/02/10
By Fredrik Wall
I currently working with clients in an environment
without any system that will update computers
Bios automatically.
So I have started to write a PowerShell script for this.
It uses Windows Forms for the output and WMI for
the information gathering.
This script is very similar to Dells VBScript for Bios Upgrades.
That script can be found here.
My script will check for current version on the computer and
then check in a file structure for the right bios upgrade version
and If It needs to be upgraded It will run the upgrade file.
My file structure is very simple and It’s located on a file share.
The bios upgrade files for Dell computers can be found
at ftp.dell.com/bios
The script is in a alpha or Beta phase, but If you are interested
in It you can mail me, DM me on Twitter or send me a message at
messenger.
Technorati Tags:
PowerShell,
GUI,
WMI,
Bios
posted
15/02/10
By Fredrik Wall
This is a function to determine if the current user
is a member of the local administrator group.
function LocalAdministrator {
$strComputer = "."
$computer = [ADSI]("WinNT://" + $strComputer + ",computer")
$Group = $computer.psbase.children.find("Administrators")
$members= $Group.psbase.invoke("Members") | %{$_.GetType()
.InvokeMember("Name", 'GetProperty', $null, $_, $null)}
$localAdmin = $false
ForEach($user in $members)
{
if ($user -match $env:USERNAME) {
$localAdmin = $true
}
}
}
Usage:
LocalAdministrator
if (!($localAdmin)) {
break
}
This will break the script if the user
don’t belong to the local administrators group.
posted
29/01/10
By Fredrik Wall
This function will not kill notes it self.
It will kill the processes.
When working with notes many people
uses a file called killnotes.exe.
This file will help when Notes hangs and you
can’t start a new notes.
It will Stop notes started processes.
This function will do the same:
function killNotes {
Stop-Process -name "nlnotes" -force
Stop-Process -name "notes2" -force
Stop-Process -name "nsd" -force
}
posted
28/01/10
By Fredrik Wall
Working with a login script for my lab active directory.
100% PowerShell using .NET classes and WMI.
This is VBScript login scripts with HTA on steroids
The GUI part was done in 10-15 min with Primal Forms.
posted
24/01/10
By Fredrik Wall
When working with MDT folders you want to sort
the folders by name to make It look better.
This is not a task you do in the Workbench.
I found a great script for this by Michael Niehaus
at Microsoft. It can be found here.
It will sort every folder in the Deployment Share structure.
The script will sort the structure by making a _TEMP_
folder and move the folder there and then move them
back sorted one by one.
You can do this manually as well in the Workbench
but It’s a big job then.
In my folder structure the comments will be deleted
this way.
If I move (copy, paste, delete old folder) a folder
in the Workbench I will get the same result.
The property “Enable this folder” seems to work just fine
with moving folders.
Is this a known bug/feature?
I will write a script that fixes this for me later on next
week. Have to do another script first
posted
24/01/10
By Fredrik Wall
One nice thing with MDT 2010 is the possibility to
make folders in the Application folder.
I like a nice structure of things and with PowerShell
I can make my structure for MDT 2010 Applications,
Operating Systems and Drivers in no time.
cls
$MDTName = "MyMDT"
$MDTServer = "\\padc01"
$MDTApplications = "Antivirus", "Browser", "Office", "Twitter", "Security", "Server"
Add-PSSnapIn Microsoft.BDD.PSSnapIn
New-PSDrive -Name $MDTName -PSProvider MDTProvider -Root $MDTServer\DeploymentShare$
foreach ($MDTApp in $MDTApplications) {
New-Item -path "$MDTName:\Applications" -enable "True" -Name "$MDTApp Applications"
-Comments "$MDTApp Applications" -ItemType "folder" -Verbose -ErrorAction SilentlyContinue
}
9 lines of code can make 50 folders in 50 sec 
And you can make it in less lines!
Technorati Tags:
PowerShell,
MDT 2010
posted
23/01/10
By Fredrik Wall
I like to do everything from my Windows 7 machine.
One administration point with all of my scripts.
So I wanted to access my MDT 2010 server thru PowerShell
from It too.
As default this will not go.
You need to Add-PSSnapIn
Add-PSSnapIn Microsoft.BDD.PSSnapIn
And you will not have that on your Windows 7 machine
out of the box. But It’s not that hard to fix.
Just install MDT 2010 on the Windows 7 machine as well.
This is a 10 MB installation file only
No problem!

And now we can access our MDT solution remote with
PowerShell.
This is a small test script
cls
Add-PSSnapIn Microsoft.BDD.PSSnapIn
New-PSDrive -Name MyMDT -PSProvider MDTProvider -Root \\padc01\DeploymentShare$
cd MyMDT:
dir
And the output will be something like
WARNING: column "CurrentLocation" does not fit into the display and was removed.
Name Used (GB) Free (GB) Provider Root
—- ——— ——— ——– —-
MyMDT MDTProvider \\padc01\DeploymentShare$
Name : Applications
Name : Operating Systems
Name : Out-of-Box Drivers
Name : Packages
Name : Task Sequences
Name : Selection Profiles
Name : Linked Deployment Shares
Name : Media
posted
23/01/10
By Fredrik Wall
My very first step was to add the Microsoft.BDD.PSSnapIn.
Add-PSSnapin Microsoft.BDD.PSSnapin
And then I could make a new PSDrive
New-PSDrive -Name MyMDT -PSProvider MDTProvider -Root \\psdc01\DeploymentShare$
When I have a PSDrive I can access it thru
cd MyMDT:
dir
Name
—-
Applications
Operating Systems
Out-of-Box Drivers
Packages
Task Sequences
Selection Profiles
Linked Deployment Shares
Media
This means that I can access my MDT solution and do
everything with PowerShell. I’m in love!
But It will get better.
To learn much and fast about how to do tasks with PowerShell you can
use the MDT Workbench.
A simple and nice task is to create a folder for every Office application
that you want to add.
With the Workbench we do like this.
On the last picture, on the right, just above finish
you got “View Script”.
This will open Notepad with a full .ps1 script
with the task that you did in the workbench.
This is nice!
Thanks DXter for the heads up on this.
More on MDT 2010 and PowerShell will come soon.
Technorati Tags:
MDT 2010,
PowerShell