Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Tuesday, 20 June 2017

Update your photo with powershell for windows Outlook/Lync/Skype-for-business/etc


NOTE: See my following post which does not required the Remote Server Administration Tools to be installed.

Thanks to the EZ IT guy who writes explaining that by installing the Remote Server Administration Tools for Windows 10 (or Windows 7 if you need it) you can then read your windows domain thumbnail photo picture.jpg like this:

$record = Get-ADUser $ENV:USERNAME -Properties thumbnailPhoto
$record.thumbnailPhoto | Set-Content "picture.jpg" -Encoding byte

And, provided that your photo is less that 100K you can also upload it:

Set-ADUser $ENV:USERNAME -Replace @{thumbnailPhoto=([byte[]](Get-Content "picture.jpg" -Encoding byte))}

All this requires that you be logged into your domain. Also thanks to the WOSHUB for help simplifying it.

If only there were a way that didn't require installing Remote Server Administration Tools.

Also some talk here from heyscriptingguy.

Wednesday, 28 December 2016

Augmenting Apple iCloud PhotoStream

As discussed previously, if you want to share in the photos of an Apple user, you have to do it the Apple way.

But once my windows PC has an incrementally downloading folder of photos, I want to upload them to Google Photos where everyone can view them.

I can upload the photos, but Google Photo's uses the file system dates when ordering the photos and ignores any timestamps in the exif tags; so somthing needs coding to extract that information from the tags to touch the files.

Furthermore, photos (and more likely, movies) that aren't tagged are totally without timestamp information.

And yet... iCloud photos viewer on windows has this information, along with comments -- none of which is stored in the images or movies.

The task

My self-appointed task is to find the source of this information for iCloud Photostream, embed it into the images and movies, and update file timestamps with it prior to upload to Google Photos.

Clues

There are some clues here: https://www.braxtonehle.com/posts/replicating-shared-photostream-to-dropbox/ but I'd already got that far by using Process Explorer to examine what files iCloud Photo was accessing.

The App

My original intention was to write a window app to upload to the Windows App Store, as the only one there to help with this seems highly priced at 

But having examined the database schema I see that this could be about 10 lines of bash scripting that works for just me; is it worth the extra work to produce a windows app?

No, but I'll do both anyway; downloading Visual Studio Express Community Edition

The bash script

The bash script is plain sqlite3 query, with the results piping into a loop at updates each file; with the usual bash presumptions that filenames won't contain a newline character, etc.

#! /bin/bash

USERDIR=/mnt/c/Users
WINUSER=flipflap
ICLOUD=AppData/Roaming/Apple\ Computer/MediaStream
DBNAME=local.db

DB="$USERDIR/$WINUSER/$ICLOUD/$DBNAME"

sq() {
  sqlite3 -line "$DB" "$@"
}

albums() {
  sq "select albumName from MSASAlbums"
}

photos() {
  sq "select assetfilepath, caption, downloaded, deleted, datetime(dateCreated + 978307200, 'unixepoch') || 'Z' as datetime, createdbyme from MSASAlbumAssets left join MSASAlbums on MSASAlbumAssets.albumGuid = MSASAlbums.albumGuid where albumName = '$1' order by dateCreated"
}

readRecord() {
  local field value count
  while read -r field _ value && test -n "$field"
  do printf -v "$field" "%s" "$value"
     count=$(( count +1 ))
  done
  test -n "$count"
}

updatePhotos() {
  while readRecord
  do file="${assetfilepath//C://mnt/c}"
     file="${file//\\//}"
     echo update "$datetime $file"
     touch -c -d "$datetime" "$file"
  done
}


if test -z "$1"
then albums
     exit
fi

photos "$@" | updatePhotos

And that works well enough.

Thursday, 8 September 2016

Windows 10 DNS Suffixes

To fix the problem of domain suffixes being applied to well-dotted fqdn:

http://superuser.com/a/680359/638934
combined with
The group policy reg keys for the searchlist are:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\"SearchList"="domain1,domain2,domain3"
and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\DNSClient\"SearchList"="domain1,domain2,domain3"
https://social.technet.microsoft.com/Forums/windows/en-US/76d07f31-62d6-4648-a3e2-7e6e16791363/append-these-dns-suffixes-not-available?forum=w7itpronetworking

Use these tricks to prefix: .,
(dot comma) to the front of the search list.

Thus each name will be tried in it's current form without any other domain suffixes first.

And so a well-dotted fqdn will resolve.

Friday, 18 July 2014

Windows can have UTC hardware clock

Thanks to reddit's Sceptically for this:

There's a registry setting you can use in windows to make it work with UTC on the hardware clock.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001

I don't know why they don't press that for you before it leaves the factory...

Dilbert.com