posted
31/12/09
By Fredrik Wall
This is a article about Windows Live Writer,
Ping Servers and PowerShell.
I use Windows Live Writer for my blogging and I
have a lot of ping servers in my list of Ping Servers.
What is Ping Servers?
Ping servers let you ping them when you post a
new blog post. And then they will publish your
new post with a link to your post.
More information can be found here:
http://en.wikipedia.org/wiki/Ping_(blogging)
It’s easy to get a large list of ping servers. But
they often contains duplicates or same urls with
and without an ending slash.
So I made a small PowerShell function that
takes my Ping Servers from Windows Live Writer
and list them. All without the ending slash.
When this is done, It’s easy to just view unique
urls.

To sort the servers and just view unique server you do like this,
Get-WLWPingServers | sort –Unique
If you want to know how many servers you got you just write
(Get-WLWPingServers | sort -Unique).count
Back in 2007 I wrote a post in Swedish about backup and restore Ping Servers.
http://itbloggen.se/cs/blogs/dalle/archive/2007/04/10/406.aspx
If we take this new function we can make a backup script in no time.
# Backup of Ping Servers
Get-WLWPingServers | sort -Unique | Out-File 'c:\scripts\pingsrv.txt'
Now we got a file with our ping servers.
If we reinstall our computer the ping server list in Windows Live Writer will be $null.
So then we need to fix a restore function as well.
And to do a restore we just need to do like this
Restore-WLWPingServers ‘c:\scripts\pingsrv.txt‘
Be aware of that this is a restore script and will overwrite your existing ping servers!
These two functions can be found here.
posted
29/12/09
By Fredrik Wall
I have made a function for my friend Anders Bengtsson
that will do a Shutdown, Reboot or Log Off.
The function uses Win32Shutdown in the WMI object Win32_Operatingsystem.

Example:
Shutdown-Computer mysrv01 ‘Log Off’
or
Shutdown-Computer mysrv01 ‘Log Off’ other
The other option will open a credential form and then uses your input for credential.
The script can be found here.
posted
27/12/09
By Fredrik Wall

This function will show the features on your Windows 7 computer or
on your Windows Server 2008 R2 server.
By default you will se all features, installed and available
for installation. With the option installed you will only see
installed features and with the option available you will
only see features that you can install.
The function can be downloaded from here.
posted
26/12/09
By Fredrik Wall
I have been away from my computer for a couple of days.
And I have been thinking about my code and now are
these functions updated.
Clean-Temp
I have tweaked the code.
No need for the same code twice
And I have added help for PowerShell 2.0.
When the function are loaded.
Try to write Get-Help Clean-Temp –detailed
Get-DotNetInfo
Uses the default browser instead of Internet Explorer.
And I have added help for PowerShell 2.0.
When the function are loaded.
Try to write Get-Help Get-DotNetInfo –detailed
More updates will be posted soon…
posted
23/12/09
By Fredrik Wall
Microsoft released the PowerShell 2.0 SDK Yesterday.
You will find It here.
Technorati Tags:
SDK,
PowerShell 2.0
posted
23/12/09
By Fredrik Wall
Me (Fredrik “Dalle” Wall) and DXter (Fredrik “DXter” Jonsson)
wants to wishes all of our friends, families, readers
and all of the rest a Merry Christmas and a happy new year!


We will both be away for a couple of days during
Christmas.
The Christmas time is a time for some time with
the family and some time without working.
The year of 2009 at poweradmin.se
- The start of the domain
- Moving posts from itbloggen.se
- More blogging
- More blogging in English
- A new staff member (DXter) joins the team
- More blogging on PowerShell and PKI
The year of 2010 at poweradmin.se (future thinking)
- A new layout (template) for Wordpress.
The one we have are not so nice with scripts.
- Find or make a plugin who will post links to
my scripts at Microsoft Script Center.
- Posting the first whitepaper (January)
- Posting the first screencast (January)
- Post the link section
Best Regards,
Dalle and DXter
posted
22/12/09
By Fredrik Wall
I uploaded my first script to Microsoft’s Script Center.
http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663
It was my Get-DotNetInfo function.
I like the repository and that you can add comments.
Please rate my function and write a comment.
Good or bad!
posted
22/12/09
By Fredrik Wall
Hi,
I sat down thinking a little bit today.
And then It strikes me that the Lab AD was not finished
and that It was not done by best practice.
So I will do the structure from this document from Microsoft,
Best Practice Active Directory Design for Managing Windows Networks.
And then we need to:
- Create groups
- Computers
- OU Information
Then I think we are where we should be.
posted
22/12/09
By Fredrik Wall
The script is not 100% finished as It is posted now in pieces.
I will be adding some check for existing users etc.
BUT I did test it last night with 5000 accounts and It did well.
Okay, I got a few error and some accounts didn’t go from disabled
to enabled. But that was like 5 out of 5000 with almost no
error handling and no check for existing users

I came up with some new ideas as well last night.
So I will add 1 or 2 articles after the script is posted.
Articles on how to make GUI for this with Windows.Forms.
posted
21/12/09
By Fredrik Wall
How to create and set user information.
It’s time to create and set our user information.
The information we want for this setup is:
- First name
- Last name
- Display name
- Description
- Telephone number
- E-Mail
- Web page
- User principal name
- SAMAccount name
- Department
- Company
To create AD users with this information, we just do like this:
# Creating the User
$objOU = new-object DirectoryServices.DirectoryEntry("LDAP://OU=$myLabOUs,OU=$labOU," + $labDomain)
$objUser = $objOU.Create("user", "cn=$FirstName $LastName")
$objUser.Put("sAMAccountName", $userSAM)
$objUser.Put("userPrincipalName",$userPrincipalName)
$objUser.Put("displayName",$displayName)
$objUser.put("mail", $userEmail)
$objUser.put("department", $myLabOUs)
$objUser.put("company","Power Admin Corp")
$objUser.put("employeeNumber", $userNumber)
$objUser.put("telephoneNumber", $userTele)
$objUser.put("wWWHomePage", "http://www.poweradmin.se/blog")
$objUser.SetInfo()
Write-Host "Created - " $firstName $lastName "($userSAM) in" $mylabOUs
$objUser.Put("givenName", $firstName)
$objUser.Put("sn", $lastName)
$objUser.Put("description", $userDescription)
$objUser.SetInfo()
# Password
$objUser.psbase.invoke("setpassword", "myH@rdP@ssw0rd99!")
$objUser.SetInfo()
# Enable the account
$objUser.psbase.invokeset('accountdisabled', $false)
$objUser.SetInfo()
# Change password at next login
$objUser.PwdLastSet = 0
$objUser.Setinfo()
This was all for this article series.
Now we have a script to create lots of accounts.
Later on I will also post error handling and more.
I will post a whitepaper on this in a couple of days.