This code can be used in a StartUp GPO script or as a manual script to clear out stuck profiles on a server. This probably won’t delete the entire profile of users that are in use, but I haven’t tested that yet. This will just leave the default required profiles behind. If you need any […]
Continue readingWorking with Powershell and the Registry
This article explain how to test whether parts of the registry structure exist for a user. The following will test if a key exists in the registry: Test-path “HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles” This will return either True or False You can also do this to see if a property exists in the key as below: […]
Continue readingMail Folders to another Mailbox with Powershell
This code allows you to export a folder and all contents to anothers mailbox with Powershell. This can be useful if a manager requires the contents of certain folders created by an ex-exployee. Export-Mailbox -Identity SourceUserName -IncludeFolders ‘\Inbox\_Misc’ -TargetFolder _Misc -TargetMailbox TargetUserName This needs to be run on the mail server Hope this helps
Continue readingDeleting Folder Contents with Powershell
Here a few methods of deleting the contents of folders with Powershell. These methods are useful for keeping servers clean and tidy and emptying users recycle bins. Clear out users recycle bin data based on SID Import-Module activedirectory [string]$recycleBinPath = ‘C:\$Recycle.Bin\’ $userSID = ((Get-ADUser chrisa).sid).value Remove-Item “$recycleBinPath$userSID” -recurse -force Delete all folders in $Recycle.bin dir […]
Continue reading