Azure VPN – Change Local Site Public IP


If a Clients Local site public IP changes the VPN tunel betwen Azure and the Local Site will disconnect. To fix this do the following:

Connect to Azure using powershell and run the following command:

New-AzureRmLocalNetworkGateway -Name LocalSite -ResourceGroupName [ClientRG] -Location ‘northeurope’ -GatewayIpAddress ‘[Public wan IP 2.4.6.8]’ -AddressPrefix ‘[LAN IP Net 192.168.1.0/24’

 

(Change the RG and Public wan IP and the LAN IP Net to the correct settings)

Delete old files from commandline


To quickly run a command (like delete) on files older than X days in commandprompt:

forfiles -p “C:\folder\Subfolder” -s -m *.* -d (Number of days) -c “cmd /c (command) @PATH”

Number of days has to be negative for days in the past (for example -30 for 30 days old). Replace “command” with the command you want to run (like del or echo)  

Show hidden files in Mac OSX


Show hidden files
Start a Terminal windows
Type followinf commands:
defaults write com.apple.Finder AppleShowAllFiles TRUE
killall Finder

Hide hidden files
Start a Terminal windows
Type followinf commands:
defaults write com.apple.Finder AppleShowAllFiles FALSE
killall Finder

Remove Ask Toolbar Commandline


To remove the ask toolbar run the following line in a elevated command line window:
MsiExec.exe /qn /X{86D4B82A-ABED-442A-BE86-96357B70F4FE} /norestart

This will work for versions 1.15.9.0 and 1.15.15.0.

 

If you want to make a .bat file it can be usefull to kill browsers before you try to uninstall Ask Toolbar.

Here is a single liner to kill IE, Chrome and Firefox in one go. Just add this line befor the MsiExec line in the bat file and you are golden

taskkill /f /im iexplore.exe /im firefox.exe /im chrome.exe

Set passwords to never expire in office 365


First, Enable .net 3.5 on your system.

Then, Download and Install Microsoft Online Services Sign-In Assistant

Microsoft Online Services Sign-In Assistant 64-bit (BETA) – <a title=”Microsoft Online Services Sign-In Assistant 64-bit (BETA) – http://www.microsoft.com/en-my/download/details.aspx?id=39267

Then Download and install Microsoft Online Services Module for Windows PowerShell

Microsoft Online Services Module for Windows PowerShell 64-bit – http://g.microsoftonline.com/0BX10EN/423

Restart computer and start “Microsoft Online Services Module for Windows PowerShell”

Type the command:  Connect-MsolService

And in the dialog enter the credentials of your Office 365 administrator

To control if a password for a single user expires
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

To change the password policy to never expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

To change the password policy to never expire for all users at once
Type the command: Get-MsolUser | Set-MsolUser -PasswordNeverExpires $True

To control that the modifications have been applied
Type the command “Get-MsolUser | fl”

And if you need to apply password policy to users

To change the password policy to expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false

To change the password policy to expire for all users at once
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false