PowerShell for Windows Admins:

Powershell


July 28, 2015  5:26 AM

WMI dates

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Dates as reported by WMI still seem to cause a lot of problems. If you use the WMI cmdlets £> Get-WmiObject -Class Win32_OperatingSystem | select *date* | fl InstallDate   : 20131205101649.000000+000 LocalDateTime : 20150728121320.002000+060   That format is year, month, day,...

July 25, 2015  7:44 AM

Self signed certificates for testing

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

A question on the forum

    0 Comments     RSS Feed     Email a friend


July 22, 2015  8:23 AM

PowerShell documentation and more

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

PowerShell has a new home.  This site on MSDN https://msdn.microsoft.com/en-us/powershell is the centre for Microsoft’s PowerShell documentation. Book mark it now!


July 22, 2015  8:04 AM

Using parameters instead of read-host when getting AD replication data

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

I’ve seen a lot of scripts recently that use Read-Host to get input data.  This is generally not best practice – I tend to only use Read-Host if I want to get a password and obscure the text on screen. A better practice is to use parameters – either in a function or a script. As an...


July 21, 2015  2:54 PM

Data for comparisons

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

A question on the forum asked about storing data used in comparisons, The example was based on a list if IP addresses where some were known to be good and the questioner wanted to filter out the known good ones so he just had to investigate the rest. You could put the data in your...


July 20, 2015  12:55 PM

Input validation on multiple regex

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell, Regular expressions

One of the things I like about writing advanced functions is the ability to validate the input. if you test the input immediately you can  often stop mistakes being made. Mistakes that could damage your system! One of the validation options is to test the input against a regular expression. Not...


July 17, 2015  12:37 PM

get-computerDN–dealing with non-existant computers

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

If you look at the working part of the code to discover the distinguished name of a computer:   £> $computer = 'w12r2sus' £> $filter = “(&(objectCategory=computer)(objectClass=computer)(cn=$computer))” £>...


July 16, 2015  12:47 PM

get-computerDN function

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

Last time I showed a bare bones function for using [adsisearcher] to retrieve the distinguished name of a domain computer. This is a somewhat expanded version of that function which adds in the sorts of features you’d want for a production ready function. function get-computerDN...


July 15, 2015  1:54 PM

ADSIsearcher returns

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

I’ve been using the Microsoft AD cmdlets (and before that the Quest cmdlets) for so long that I’d sort of forgotten about [adsisearcher]. It was introduced in PowerShell 2.0 and is a shortcut for System.DirectoryServices.DirectorySearcher A question in the forum about using this remotely...


July 14, 2015  12:05 PM

Disk identification

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell, WMI

A recent question on the forums regarded using the Win32_LogicalDisk class to retrieve disk size and free space data.  A filter based on the disk letter was being used. The main error with the code was that the filter was being expressed as "DeviceId='E'" rather than "DeviceId='E:" The...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: