header image

Archive for June, 2012

I recently (1 June) showed how to discover the user profiles on your system. Now its time to delete them. function remove-profile { param ( [parameter(Mandatory=$true)] [string]$username ) $user = Get-CimInstance -Class Win32_UserAccount -Filter "Name = ‘$username’" $profile = Get-CimInstance -Class Win32_UserProfile -Filter "SID = ‘$($user.SID)’" $folder = Split-Path -Path $profile.LocalPath -Leaf if ($folder -eq […]

under: PowerShell and WMI, PowerShell V3, PowerShellV2

  This post http://powershell.com/cs/blogs/tips/archive/2012/06/05/checking-size-of-downloads-folder.aspx go me thinking about the temp folder. Its one of those areas tucked away in your profile that just seems to get left to grow.  Time to do something about it. $testdate = (Get-Date).AddDays(-10) $names = "FXSAPIDebugLogFile.txt", "hsperfdata_Richard" ## assume TMP = TEMP $path = $env:TEMP Get-ChildItem -Path $path -File | […]

under: File System, PowerShell V3

If you haven’t seen them already Microsoft’s ScriptingGuy has kindly published a couple of excerpts from PowerShell in Depth by Don Jones, Jeff Hicks and myself http://blogs.technet.com/b/heyscriptingguy/archive/2012/06/04/powershell-in-depth-part-1.aspx http://blogs.technet.com/b/heyscriptingguy/archive/2012/06/05/powershell-in-depth-part-2.aspx Enjoy

under: Books, PowerShell V3

One of the questions in the recent Scripting Games involved toggling between a wireless and LAN connection. Only one was to be up at any one time. This can be solved using WMI but becomes hugely simpler in Windows 8/2012 as we get a bunch of cmdlets for working with network adapters. Using WMI Get-WmiObject […]

under: Networking, PowerShell and WMI, PowerShell V3, Windows 8, Windows 8 Server

Another question at Tuesdays PowerShell group revolved around using colons to link values to parameters. I’d not really thought about before. Thinking about it  later I realised that you only really see it when passing booleans to –Confirm.  If you don’t use a colon then you get this PS> Disable-NetAdapter -Name "Virtual Wireless" -Confirm $false […]

under: PowerShell original, PowerShell V3, PowerShellV2

A question came up on Tuesdays UK PowerShell Group session about using the Windows 2012 Active Directory module. The recording links are here http://msmvps.com/blogs/richardsiddaway/archive/2012/05/30/may-2012-powershell-group-recording-and-slides.aspx The question asked if the new Site, Subnet and Site link cmdlets would work in a legacy environment. This morning I installed a Windows Server 2012 Release Candidate member server into […]

under: PowerShell and Active Directory, PowerShell V3, Windows 8 Server, Windows Server 2008 R2

Hot on the heels of the Windows 8/2012 release candidates comes the PowerShell v3 (well Ok the Windows Management Framework) release candidate. This is available for Windows 7 SP 1 Windows Server 2008 R2 SP 1 Windows 2008 SP2 32 and 64 bit versions are available as applicable to the OS Notice the omissions Vista, […]

under: PowerShell V3

This is the release candidate in all but name – the Windows Server 2012 is known as the Release Candidate which is confusing.   I don’t intend to write full reviews but just little notes of things I discover as I’m experimenting.   Just been puzzling over the maps app & the location it showed […]

under: Windows 8

A question came up on the forum for PowerShell and WMI – how do I delete profiles. I’m going to work up to answering that by looking at using WMI to work with profiles. So to start how can we find the profiles available on our system Get-WmiObject -Class Win32_UserProfile | select LocalPath, SID, @{N="LastUseTime"; […]

under: PowerShell and WMI, PowerShell V3

« Newer Posts