I'm using Sharepoint 2010. I've looked and tested several methods to try to do what is describe in the title of this post, but none of them are working.
In the best case, the so called attribute is modified during the script execution but modifications are not saved and my Webpart stays in the same state.
Here is my current attempt. It is not working even if there is no error thrown.
$web = get-spweb "http://whatever";
$list = $web.lists["myList"];
$list2 = $web.lists["my2ndList"];
$wpPage = $list.RootFolder.files | ?{$_.url -match "dispform.aspx"};
$webpartManager = $wpPage.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared);
$webpart = $webpartManager.webparts[$index]; # index of the webpart on the page. It's correct because I can see all the properties that I want.
$viewID = $webpart.ViewGuid.ToString();
$view = $list2.Views | ?{$_.ID -eq $viewID};
$setToolbarTypeParameterTypes = [uint32];
$setToolbarTypeMethod = $view.GetType().GetMethod("SetToolbarType", [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic, $null, $setToolbarTypeParameterTypes, $null);
$setToolbarParameters = [uint32] 1; # this is suppose to set the tooblar to "None"...
$view.Update();
$wpPage.Update();
$web.dispose()