I have been working with PowerShell and SCCM for the last 4-5 years and I have built some nice to have Functions that I often use. If you ask me 🙂 Now 50% of all readers will say “You don’t need to use WMI” or “You should connect in another way to WMI”. In a new environment with SCCM 2012 and with PowerShell 3.0 or 4.0 you are probably right 🙂 I have been making tools and administered SCCM 2007 environments most of the time and with client computers with PowerShell 2.0. So my code will work on SCCM 2007 […]
I have been bloging about PowerShell for lots of years and Co-Founded the PowerShell User Group Sweden and I’m one of the community leaders for It. I love to blog and I love to bring information regarding PowerShell to others because I love PowerShell. So when a friend of mine told me last week that I was on Feedspots top 50 I was happy. I have been on some lists before, thats cool. But now I have been thinking about this one. This is a service with lots of blogs on It and the readers reading my blog 🙂 Number 50 […]
This is an updated post from my series about “Creating graphical programs with PowerShell” that I wrote in 2013. The series was first published on poweradmin.se and from part 3 on PowerShellTaskforse.com. This is an updated version and I will use another setup in my Lab environment then back in 2013. In this first part I will show you how to start using PowerShell Studio and how to do the first part of the design of the form. My lab environment for this blog series is: Windows Server 2016 with Active Directory PowerShell studio 2017 I will show you how […]
For me the structure for my scripts are one of the most important thing. Create a structure for your scripts Regardless if it’s on your local computer or on a server Use the same all the time Why? To find your own scripts easily after some time So your coworkers can find your scripts So you can find your coworkers scripts If you don’t have a structure and you create scripts everywhere you like. Then you might have scripts in your c:\ root, c:\scripts, your documents folder, in a script editors path, on a share, on a cloud share etc […]
This is the second post from my session about thinking before scripting in an business environment. Or what to think about when scriptning. ALLWAYS think before scripting. Okay, this is good to do all the time when scripting. What type of script should you do? Why should you do It? What and who will be involved? How many clients/servers will it be runed from? Think larger Thing same This can sound strange, but It’s not 🙂 All of these questions are relevant to find out how complex the script needs to be. And these follow question are relevant as well. What […]
Hello, I did a session on scug.se – Client days at Microsoft in Akalla, Sweden last Thursday. The session was about thinking before scripting in an business environment. I talked about: Always think before Structure Name Comments No hardcoded Administrator Control aka Validating Dependencies Error handling Log handling Editors This was my first session for a larger group (~150 people). It was fun to talk about something I like. Thanks to Stefan and Jörgen for letning me talk to the group and thanks to Nickolaj for the support on stage. In 11 posts I will write about what I […]
Hello, I’m currenly adding old updated stuff that I have published before at poweradmin.se or at powershelltaskforce.com. I will rewrite about 30 articles that I know people have missed. The rewrite is due to that the original posts was from 2009 to 2-3 years ago and I have updated my functions and stuff over and over. When I’m done with that I will add lots of new stuff. I have been away from bloggning a couple of years, but I have not been inactive with scripting 🙂 Best Regards, Fredrik
I have been working with this function for a long time. And now it’s time to share it with you.
Looks up Active Directory information about a computer
Looks up Active Directory information about a computer object using LDAP
The name of the computer that you want to get information about
Get-LDAPComputer -ComputerName PC001
"PC001","PC002" | Get-LDAPComputer
("PC001" | Get-LDAPComputer).Path
"PC001" | Get-LDAPComputer | gm
NAME: Get LDAP Computer Information
AUTHOR: Fredrik Wall, email@example.com
Param ([Parameter(Position = 1, Mandatory = $true, ValueFromPipeline = $true)]
foreach ($myComputer in $ComputerName)
$myActiveDomain = new-object DirectoryServices.DirectoryEntry
$myDomain = $myActiveDomain.distinguishedName
$mySearcher = [System.DirectoryServices.DirectorySearcher]"[ADSI]LDAP://$myDomain"
$mySearcher.filter = "(&(objectClass=computer)(name=$myComputer))"
$mySearcher = $mySearcher.findone().getDirectoryEntry()
$myDistName = $mySearcher.distinguishedName
It’s a function for looking up computer objects in the AD without the AD CMDLet.
In some blog articles over 7 years I have been writing two functions to create real names to use with creating Active Directory Lab user accounts. And when I started to go thru my blog post last year I saw that some of my older stuff was not in a good condition. They was good back in the days! Not so much now! 🙂 So I have been going thru my old blog and started to rebuild some of the old stuff in more modern ways. The Get-SNames and Get-FNames functions was not working as they did in 2009 and […]
Hello and welcome to my new blog! I have been blogging on www.poweradmin.se and www.powershelltaskforce.com for many years. And I’m currently running The PowerShell User Group Swedens blog. This is the first time that I will focus on blogging all by my self. The focus will be of cource PowerShell, Active Directory, Deployment and Windows client management. More information and blog article will be posted in a couple of days. Best Regards, Fredrik Wall