Background jobs were one of the most undervalued aspects of PowerShell v2. With the introduction of PowerShell v3 we get ways to schedule those jobs. In this post though I want to look at the new CIM cmdlets and jobs. Using the WMI cmdlets most PowerShell users have done something like this: PS> Get-WmiObject -Class […]
Archive for September, 2012
Every time I look at PowerShell v3 I seem to find a new way to access WMI! I’ve covered the –ComputerName and –CimSession parameters before but to recap We duplicate the way Get-WmiObject works: $computer = $env:COMPUTERNAME Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $computer We can use CIM sessions $cs = New-CimSession -ComputerName $computer Get-CimInstance -ClassName […]
PowerShell remoting and upgrading to Windows 2012
Posted by: richardsiddaway | September 23, 2012 | 1 Comment |I have a number of virtual machines running Windows 2008 R2 and I upgraded one of them to Windows 2012 – an over the top upgrade rather than a format and clean install I found that Get-PSSession –Computername didn’t work against that machine. This parameter now looks at the remote machine endpoint and gets all […]
Advanced notice that there will be a Games next year – its changing a bit though. See http://powershell.org/games/
The new –showwindow parameter in Get-Help pops up a little window containing the FULL help file. Much better than having to rememebr to use –full. PowerShell immediately returns the prompt so you can continue working – means you can have a number of help files open simultaneously. Get-Help -Name Get-Process –ShowWindow This gets to be […]
Change user attribute based on group membership
Posted by: richardsiddaway | September 17, 2012 | No Comment |Want to change an attribute on all members of an Active Directory group. Then try this Get-ADGroupMember -Identity Legal | where {$_.objectclass -eq "user"} | foreach { Set-ADUser -Identity $($_.distinguishedName) -Department "Student" } Get the group members – filter out nested groups by checking the objectclass of the object. For each user set the attribute. […]
Decoding the mounted device information
Posted by: richardsiddaway | September 16, 2012 | No Comment |In the previous post we looked at how to read the mounted device information. The data is in binary though – if you want it readable and not all of it is readable – try this $data = @() Get-Item -Path HKLM:\SYSTEM\MountedDevices | select -ExpandProperty Property | where {$_ -like "\Dos*"} | foreach { $name […]
Reading mounted device information from the registry
Posted by: richardsiddaway | September 16, 2012 | No Comment |Interesting question about reading the registry. How do you read HKLM:\SYSTEM\MountedDevices and pull out the name of the device and the associated data. Get-Item -Path HKLM:\SYSTEM\MountedDevices returns data of this form Name Property —- ——– MountedDevices \DosDevices\C: : {218, 187, 32, 142…} \DosDevices\G: : {92, 0, 63, 0…} \DosDevices\E: : {95, 0, 63, […]
There seems to be a bit of cofusion about how Get-Random works. Try this 1..10 | foreach {Get-Random} you’ll get randomly selected 32-bit unsigned integer between 0 (zero) and Int32.MaxValue (0x7FFFFFFF, 2,147,483,647). The –Minimum parameter sets a minimum value – you will not get any values BELOW this try this 1..10 | foreach {Get-Random -Minimum […]
The dates for the summit have been announced – 22-24 April 2013 @ Microsoft campus Redmond You can register at http://powershell.org/summit 1/7 th of the tickets have already gone – don’t miss out.
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS