Query lookup field

23/06/2015 10:46

$web = get-spweb "https://yourcollectionurl"
$list = $web.Lists["Your list name"]

$lookupValue = 1

$query = new-object microsoft.sharepoint.spquery;
$query.Query = "<Where><Eq><FieldRef Name='yourLookupFieldInternalName' LookupId='True'/><Value Type='Lookup'>"+ $lookupValue +"</Value></Eq></Where>";
$items = $list.GetItems($query)

$items.Count
$items