31 December 2016

Set ImmutableID for Office 365 user

From the Azure Active Directory command line:

Set-MsolUser -UserPrincipalName "joe@bloggs.com" -ImmutableId "123xyz"

Set to null:

Set-MsolUser -UserPrincipalName "joe@bloggs.com" -ImmutableId "$null"

24 March 2016


If you expect an answer, Microsoft, ask a fucking question.

20 March 2016

List Exchange users that are (or have) delegates

Use this command:

ldifde -f delegates.txt -d "ou=Users,dc=domain,dc=com" -l name,publicDelegates,publicDelegatesBL -r "(|(publicDelegates=*)(publicDelegatesBL=*))"

Cheers, William Lefkovics.

Check progress of PST imports in Office 365

First, get the RequestGUID for the import request (because the ImportRequest name is different from the RequestGUID, even though they look similar):

Get-MailboxImportRequest | ft Mailbox,RequestGUID

Then get the detailed report on that import:

Get-MailboxImportRequestStatistics -Id (The RequestGUID) -IncludeReport |fl

Empty Recycle Bin for all users

From an elevated command prompt:

rd /s c:\$Recycle.Bin

Enable remote administration access from the command line

For tools that use WMI/RPC/DCOM.

netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes

Remotely log off users

Check the sessions on a remote server:

qwinsta /server:myservername

Kill the session with ID "4":

rwinsta 4 /server:myservername

Access the Exchange Admin Center for Office 365 Small Business

Because Microsoft couldn't be bothered putting a link to it in the Small Business GUI:

https://outlook.office365.com/ecp/

19 March 2016

Set Windows proxy settings at the system level

Check the current proxy settings:

netsh winhttp show proxy

Set the proxy settings (bypassing local addresses):

netsh winhttp set proxy myproxyserver:8080 "<local>"

Reset/remove the proxy settings:

netsh winhttp reset proxy

Change SID of Server 2012 R2 machine

If you've cloned a Windows Server 2012 R2 machine, you may need to change its SID:

  1. C:\Windows\System32\Syprep\sysprep.exe - Run As Administrator.
  2. Select "Enter System Out-of-Box Experience (OOBE)", tick "Gereralize", select "Reboot", click OK. The server will restart.
  3. After reboot, follow the Settings wizard.
  4. Set the server's static IP address again, if necessary.

Ta, M Hamizi.

Connect PowerShell to Office 365

Connect to Office 365 (MSOL) PowerShell:

  • $UserCredential = Get-Credential
  • Connect-MsolService -Credential $UserCredential

Connect Remote Exchange PowerShell for O365:

  • $UserCredential = Get-Credential
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  • Import-PSSession $Session

       Once finished, remove your session:

  • Remove-PSSession $Session

10 March 2016

Fix broken trust relationship without rejoining domain

To fix the seemingly-random "The trust relationship between this workstation and the primary domain failed" error, you can remove the PC from the domain, then re-add it. Sometimes doing this is a PITA.

You can often fix the error using netdom.exe with the below steps. You can do it through your remote access utility, or by logging in as a local administrator.

  1. Extract netdom.exe and netdom.exe.mui from the Remote Server Administration tools. Or grab them from a machine that already has the tools installed.
  2. Put netdom.exe in C:\Windows\System32\ , and netdom.exe.mui in C:\Windows\System32\en-US\ , on the broken PC.
  3. Run the following command on the broken PC:

    netdom.exe resetpwd /s:myserver /ud:MYDOMAIN\adminuser /pd:(adminpassword)

    (Where "myserver" is your domain controller, "MYDOMAIN\adminuser" is a domain administrator, and "adminpassword" is the domain administrator's password.)

Enable file and print sharing from the command line

Run this command on the remote computer to enable file and print sharing (all one line):

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

15 November 2015

Use Adobe CS5 applications without Java on OS X

Using OS X, opening the Adobe CS5 applications may prompt you to install Java 6. To bypass this prompt without installing Java, make sure both these directories exist:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/
/System/Library/Java/Support/Deploy.bundle/

You can create them via Terminal using the following commands:

sudo mkdir -p /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
sudo mkdir -p /System/Library/Java/Support/Deploy.bundle

Thanks to Michael Stassen.

19 July 2015

Reset album artwork cache in Sony Music app

Sometimes the Sony Music app gets confused and displays incorrect album art. Using the File Commander app, reset the cache by deleting these two folders:

\Android\data\com.sonyericsson.music\files\cache\ContentCache
\Android\data\com.sonyericsson.music\files\cache\thumbnail-generic

FFmpeg commands

To convert an MKV to MP4:

C:\Program Files\WinFF\ffmpeg.exe -i input.mkv -c copy output.mp4

To extract the audio from an MP4:

C:\Program Files\WinFF\ffmpeg.exe -i use-audio.mp4 -vn -acodec copy audio.mp4

To replace the audio in an MP4:

C:\Program Files\WinFF\ffmpeg.exe -i use-video.mp4 -i audio.mp4 -vcodec copy -acodec copy -map 0:0 -map 1:0 output.mp4

Enable remote access to Event Logs from the command line

Run this command on the remote computer to allow viewing of its Windows Event Logs from another computer (all one line):

netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes

Create DVD ISO in OS X

To create an ISO from a DVD in OS X, using Terminal:

sudo hdiutil makehybrid -o FileName.iso /Volumes/PATH_TO_DVD/

16 May 2015

Get ImmutableID for AD user

To get the ImmutableID for an AD user, run the following then look for the ObjectGUID in the output file:

ldifde –d “CN=John Doe,OU=Users,DC=domain,DC=local” –f c:\temp\data.txt

Ta, 4ward.

09 February 2015

.htaccess for browsing directories

To list the contents of a directory, the .htacess file should contain:

Options +Indexes