PowerShell: Setting Exchange Send-As Permissions without Using the Add-ADPermission cmdlet

The Send-As permission for objects in Exchange is set on the AD object (rather than the mailbox itself). Normally, the weapon of choice is the Add-ADPermission cmdlet but interestingly that cmdlet is only available if you have some serious Exchange permissions; Organization Management. What you’re doing though requires fairly low-level AD permissions; you’re just modifying some attributes on an object. So I did some investigation and came up with a function to set Send-As permissions without using Add-ADPermission. Continue reading “PowerShell: Setting Exchange Send-As Permissions without Using the Add-ADPermission cmdlet”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 5

I’ve made some more changes to the syncing script. The first was some corrections about how it deals with paths with ‘odd’ symbols in them (like “[“) and the second was to properly output objects listing all the changes its made (for logging or further processing).

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 5”

PowerShell: Converting PDF Bank Statements to PDF

I wrote some very quick and dirty code to import American Express PDF statements to CSV here.  I could export the PDF to TXT and then process the text file with PowerShell.I had to revisit it the other day as I had a raft of PDF statements to convert and import into YNAB (and not just from AMEX).

Of course, all the bank and credit card vendors use a standard PDF format for statements so it was easy.

Right?

No, actually pretty much everyone just does their own thing.  And by ‘own thing’ I mean PDFs that are not even consistent within themselves.

So:  the joy of regular expressions. Continue reading “PowerShell: Converting PDF Bank Statements to PDF”

PowerShell: Copy Directory Structure and a Random Sample of Files from Each Directory

I got my wife a new digital picture frame as a present.  It looks cool but the attached storage options (USB or card) aren’t big enough to take all our digital photos.

The decision about which pictures to include relies on either organisational skills OR an artistic eye, neither of which I have.

So what about making it strictly random?  Copying the entire directory structure but only a random sample of the files in each folder?

That I CAN do 🙂 Continue reading “PowerShell: Copy Directory Structure and a Random Sample of Files from Each Directory”

PowerShell: Fixing “Windows could not connect to the Group Policy Client service”

My wife got this error the other day on her Windows 10 machine when trying to login.  After a bit of digging, it seems it’s not unheard of but there’s no clear answer about why it happens (It’s a corrupted / missing set of registry entries.  The cause could be a bad shut-down, crash, interrupted update or pre-cursor to Martian attack.  Who knows.)

I found a good site that provides a solution. To fix the issue you need to create a registry sub-key and value (confusingly, both of the same name) and a pair of values under the sub-key you just created. That cures the problem but there’s no more information about to how to prevent it happening again.

In lieu of a proper preventative solution I wrote a script to perform the changes (with a bit of safety code too) so if it re-occurs I’m good to go.

Script and walk-through after the line. Continue reading “PowerShell: Fixing “Windows could not connect to the Group Policy Client service””

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 4

Some more additions to the script.  In this part I add some additional configuration options, parameter validation and some error-checking.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 4”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 3

I’ve used the Sync-Folder script quite a bit and I thought it might be time to revisit it, clean it up and add some more functionality.

Here’s what I’m adding in this first part;

  1. Load all the configuration from an XML file.  Useful to allow more complex configurations and a lot easier to edit that parameters or local variables.
  2. Proper documentation (so that Get-Help returns useful information).
  3. Allow multiple Source / Target pairs instead of just the one source folder.   Multiple copies of the same source is good for extra safe backups.

The script and explanation follows after the line.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 3”