Modifying ProxyAddresses attribute for a user in Powershell

Getting the current ProxyAddresses attribute value for a user in Powershell :

Get-ADUser -Filter 'Name -like "*username*"' -Properties ProxyAddresses

 

Setting several values for ProxyAddresses attribute :

Set-ADUser -Identity username -add @{Proxyaddresses="SMTP:username@domain",

"smtp:alias1@domain","smtp:alias2@domain"}

 

 

Advertisements

Single or double quotes in Active Directory cmdlets

A special syntax for the Filter parameter is required for some Active Directory PowerShell cmdlets such as Get-ADUser to get the expected result.
This article explains perfectly how to properly handle it : http://www.powershellish.com/blog/2015-11-17-ad-filter

Windows PowerShell Syntax Plugin set up in gVim

Windows PowerShell Syntax Plugin provides Syntax coloring, indenting and filetype detection for Windows PowerShell.

It is available at :

http://www.vim.org/scripts/script.php?script_id=1327

http://github.com/PProvost/vim-ps1

If you use Pathogen, just extract into your bundle folder.

If not, just set up Pathogen as follows below :

https://github.com/tpope/vim-pathogen

Additional actions to make it work on Windows 7 :

cd C:\Program Files (x86)\Vim\vimfiles
mkdir autoload
mkdir bundle

Install pathogen.vim in C:\Program Files (x86)\Vim\vimfiles\autoload

To enable Pathogen, add this to your gvimrc :

execute pathogen#infect()
syntax on
filetype plugin indent on

On Windows 7/10, the gvimrc file must be named as _gvimrc and located in one of the folders :

$HOME/_gvimrc
$HOME/vimfiles/gvimrc
$VIM/_gvimrc

$HOME points to your home directory in Windows 7 and $VIM points to your directory where Vim/gVim have been installed.

The personal initialization files are searched in the order specified above
and only the first one that is found is read.

http://vimhelp.appspot.com/gui.txt.html#gvimrc

This plugin is now enabled. Enjoy !

Setting aliases in Powershell 4

In Powershell, aliases are shortcuts for cmdlets or for your own functions.
You can create one easily using New-Alias or Set-Alias cmdlets.
To make them available within any Powershell session, put them in the $Profile configuration file.
Let’s have an example :

function start_vm() {
VBoxManage startvm "devbox"
}

Set-Alias -name svm -value start_vm -description "Booting dev VM"

To make these new aliases available in your current session, reload your configuration file :

.$Profile

To list all the available aliases :

Get-Alias

or

gal