I was playing around with PowerShell and started thinking about the kb, mb etc values and I realised I didn’t know what they really looked like. 1kb is 1024 but it gets very hazy after that. So how could I see the values stacked up 1kb,1mb,1gb,1tb,1pb | foreach{"$_".PadLeft(16)} works. We feed in the list of […]
Archive for April, 2009
I’ve looked at creating a process before – using [WMIClass]. With CTP3 we have a few more options Start-Process -Filepath notepad.exe Invoke-WMIMethod -Class Win32_process -Name Create -ArgumentList notepad.exe Set-WMIinstance -Class Win32_process -Arguments @{Path=c:\windows\system32\notepad.exe} The first two just happen. The third option will throw an exception because it can’t find the […]
If you haven’t seen the post on PowerShell standard verbs from the PowerShell team it is worth reading – http://blogs.msdn.com/powershell/archive/2009/04/22/soliciting-new-verbs.aspx If you have an idea for a new verb – make sure you make it known
One of the big pieces of functionality in PowerShell v2 is the ability to directly administer remote machines. A number of cmdlets get a computername parameter for working directly. The main push for remoting is through the *-PSsession cmdlets Enter-PSSessionExit-PSSessionExport-PSSessionGet-PSSessionImport-PSSessionNew-PSSessionRemove-PSSession New-, Get and Remove- I have blogged about before. The interesting ones are the Enter/Exit […]
Been looking at Exchange 2010. It installed OK on Windows 2008 R2 Beta and seemed to run OK. I have come across a few issues: Exchange Management Console doesn’t start properly and doesn’t run properly The new Remote PowerShell functionality doesn’t work (against Windows 7) I think this is due to trying to work two […]
I had a question come through as a private message regarding how to extract a particular attribute for user objects. The script wasn’t working because the label name in AD Users and Computers didn’t match the attribute name. This is a fairly common scenario as there are quite a few attributes like this for instance […]
Sorting is a fairly common activity in PowerShell. One scenario I don’t see very often is a requirement to sort in two different directions. I have a list of users and their last logon dates – I want to sort users into alphabetical order (ascending) and lat logon into descending order. 001 Import-Csv logons.txt | sort @{Expression="Name";Descending=$false},@{Expression="LastLogon";Descending=$true} We have […]
Back in February – http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!2099.entry – I showed a module I had created to generate a new password. Its time to return to that module. I am going to expand it to work with local user accounts. Then I’ll add AD accounts. I have a script that I wrote a while back to work with […]
We can find the forest and domain modes using the following commands Get-ADDomain -Identity grayson | select DomainMode Get-ADForest grayson | select forestmode The modes can be set from the GUI as normal or Set-ADDomainMode -Identity grayson -DomainMode Windows2008R2DomainSet-ADForestMode -Identity grayson -ForestMode Windows2008R2Forest Not that you will be using these cmdlets very often Technorati […]
Windows Server 2008 R2 is 64 bit only so we we get two instances of PowerShell and ISE. One (64bit version) is just labelled Windows PowerShell V2 and Windows PowerShell V2 ISE. The 32bit version has (x86) appended to the name. One point to watch for – the 64 and 32bit versions have different execution […]
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