header image

Archive for January, 2013

A question on my blog asked how do you know which domain controller you are running against when you search Active Directory. Unless you explicitly instruct your script to use a specific domain controller it will use the one to which you authenticated. You can find the DC to which you authenticated with this simple […]

under: PowerShell and Active Directory

A forum question regarding retrieving WMI based data from multiple servers and displaying it as HTML was interesting.  I would approach it like this $servers = Get-Content -Path C:\scripts\servers.txt $data = @() foreach ($server in $servers){ $compdata = New-Object -TypeName PSObject -Property @{ Computer = $server Contactable = $false LastBootTime = "" AllowTSConnections = $false […]

under: PowerShell and WMI, PowerShell V3, PowerShellV2

A question on the forum about a function had me thinking. The user had defined two parameters for the function and then used Read-Host to get the values. NO Much better way is to use an advanced function and make the parameters mandatory function Getuserdetails { [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$Givenname, [parameter(Mandatory=$true)] [string]$Surname ) Get-ADUser […]

under: PowerShell and Active Directory, PowerShell Basics, PowerShell V3, PowerShellV2

I’ve written a series of articles on PowerShell workflows that are appearing on the Scripting Guy blog. The first two in the series have been published at: http://blogs.technet.com/b/heyscriptingguy/archive/2012/12/26/powershell-workflows-the-basics.aspx http://blogs.technet.com/b/heyscriptingguy/archive/2013/01/02/powershell-workflows-restrictions.aspx   Enjoy

under: PowerShell V3

« Newer Posts

Categories