using get-odbcdsn across all domain computers - powershell

So I need to create a report of what odbc-dsns are on computers.
The first hurdle I'm trying to do is get the csv to output correctly on MINE. Then I figure I'll just deploy a runonce group policy with the script set to append.
The problem is that get-odbcdns returns an object. That object has:
Name: the friendly name of the odbc
Attribute : {Description}
I just want to be able to formatlist with the VALUE of the {Description} value inside the Attribute property. I can't figure out how to do that.
Whenever I go | fl name, attribute
it returns 1sl-den-db01 and {description} I would like for it to actually parse out description from Attribute. No idea how. Thoughts?

Related

SharePoint REST: Column does not exist error

I'm calling a REST API with a SharePoint Designer workflow on SharePoint online. I'm setting the column name with a variable, and when i put the variable into my URL to call it it says "Column [name] does not exist".
Annoying part is when I call just /items? I can see the column in the result, but if I try select it or filter by it I get 'does not exist'. I have alot of these columns similarly named, and I get the error for all of them.
I am using the internal name, I have tried adding "OData_" to the front. I've tried typing the url manually in the browser and entering values (incase the variable was causing issues) but I get the same error, column does not exist. but i can see it them I call all items. :(
so I have quite a few columns with naming convention "[Q#] Score [#]" eg "Q4 Score 2". The internal name that's clearly appearing in the full items results is "Q4_x0020_Score_x0020_2".
This works:
https://MYSITE.sharepoint.com/sites/portal/intranet/CorpServices/QSR/_api/web/lists/GetbyTitle('Audit')/Items?
and I get big full normal REST results that includes the line:
0
However if I try:
https://MYSITE.sharepoint.com/sites/portal/intranet/CorpServices/QSR/_api/web/lists/GetbyTitle('Audit')/Items?$Select=Q4_x0020_Score_x0020_2
Then I get:
-2146232832, Microsoft.SharePoint.SPExceptionColumn 'Q4_x0020_Score_x0020_2' does not exist. It may have been deleted by another user.
I expect to be able to select that column (and the dozens like it) but none work. I've searched all similar problems on the forum and they've usually got a spelling mistake or forgot the ODATA_ but i cant seem to get the problem. Please help.
It seemed to be working intermittently.... So it was in fact just a naming error...... Half of the columns were [Q#]_x0020_Score_x0020_[#] and half were [Q#]_x0020_score_x0020_[#]. The word "Score" was capitalized on some and not others. I Didn't realize the HTTP Calls were case sensitive. Now I have added a bunch of if statements to handle the different variations haha. Thanks for reading.
Judging by the naming convention you are on an older version of SharePoint. The x0020 is the value for a space. Ideally when you first create the column you would name it without the spacing. For example UserInformation. Then come in and edit the name after the fact and call it User Information. If you click on the title name and look at the URL, you will see what the actual name of the column is at the end of the URL. It is case sensitive because you can have a column named score and Score which is ultimately why it wasn't working.
Must load all fields like this
var lists = context.Web.Lists;
context.Load(lists);
context.ExecuteQuery();
CamlQuery query = new CamlQuery();
query.ViewXml = #"";
var list = lists.GetById("file.guid");
var listitems = list.GetItems(query);
context.Load(listitems);
context.ExecuteQuery();
var creationInformation = new ListItemCreationInformation();
var newItem=list.AddItem(creationInformation);
var fields = list.Fields;
context.Load(fields);
context.ExecuteQuery();

How to get Shape Name in office 365 office.Interop.word

How can I get the exact picture name from word.Document.Shape.Name method. I tried that but it is not getting the exact name. I tried like
objWord.Document.getItem(activeWord).Shape.getItem(index).Name
But it won't get the exact name. Is there any other method to return the Logo name in a document?. Should InlineShape serve the above functionality?.
Please suggest how can I retrieve the Logo name inside a Word document. I'm using Word 2016.
The behavior you report - losing the Shape.Name when copying/pasting between documents - is to be expected. Since this is a Shape, use the Shape.AlternativeText property to store the information currently in the Shape.Name. That will come across intact.

Powershell enumerate properties of properties

I have a commandlet that gathers information from a device register:
PS C:\windows\system32> Get-PSDevice serverA
HostName: ServerA
OOB:
Criticality: Normal
IsVirtual: True
etc
Some of these have an array of 'sub properties' inside, for example:
Cluster : #{Url=https://ps-apps.com/DeviceRegister/api/Clusters/62; VCenterUrl=https://ps-apps.com/DeviceRegister/api/VCenters/2; ClusterId=62; VCenterId=2; Name=Vcenter 1 ABC Prod;
DataCenterUrl=https://ps-apps.com/DeviceRegister/api/DataCenters/3; DataCenter=; IsValidated=True; IsExceptionCluster=False; SupportsProdWorkloads=False; SupportsNonProdWorkloads=False; SupportsSqlWorkloads=False;
ManagedByabc=False}
I can get whatever property within the aray I want using something like:
(Get-PSDevice ServerA).cluster.name
I'm trying to determine a way to enumerate all of the sub properties using a foreach type statement to populate a value.
What would be the best way to achieve this?
Every object in PowerShell has a hidden .PSObject property which tells you things about the object. One of its properties is a .Properties property (as PetSerAl points out, it's not a property but in fact a MemberSet, though you access it with property semantics).
(Get-PSDevice ServerA).cluster.PSObject.Properties
That would return [PSProperty] objects that show you the information about the properties (the name, value, type, whether it's gettable and settable, etc.).

PowerShell/PowerCLI how to display object properties

I am using PowerNSX module to work with NSX and I would like to retrieve ESG syslog server configuration.
I have managed to find out how to get values using $esgs = get-nsxedge and then retrieve values by typing $esgs.features.syslog.serveraddresses
I've got an output of several IP's. I would like to display ESG name (it is retrieved from get-nsxedge) and combine it with retrieved syslog IP.
How can I achieve this?
Br
wojcieh
Based on above description I guess that the information you want to combine is stored in $esgs. To select the name and the IP addresses you've to use calculated properties.
Example:
$esgs | select-object -Property PropertyNameWhereEsgNameIsStored, #{Name="IpAddresses";Expression={$_.features.syslog.serveraddresses}}
Hope that helps

Sharepoint REST Field Property does not exist

I am using Postman for Chrome to test some simply stuff with Sharepoints REST Api.
Well - I get an error right in the beginning while trying to retrieve certain Fields from a List - here are some pictures:
SharePoint List:
Calling for CPU
Calling for RAM - which fails:
(EXmsg: Field Property 'RAM' does not exist)
Anyone has a clue? I do not understand this at all.
Thanks in Advance!
P.s.
When calling:
/_api/web/lists/getbytitle('Anwendungen')/items
RAM will be displayed as a property of "zzfu" - dafuq?
This error occurs since $select query option accepts field internal name but not display name.
Having said that, you might need first to determine field internal name, for example:
/_api/web/lists/GetByTitle('Anwendungen')/fields?$select=InternalName&$filter=Title eq 'RAM'
Once the field internal is determined, you could query field value like this:
/_api/web/lists/GetByTitle('Anwendungen')/items?$select=<RAM internal name>
where <RAM internal name> is RAM field internal name.