Questions tagged [new-object]

`New-Object` cmdlet creates an instance object in powershell

Docs: MSDN: New-Object

Usage

$object = New-Object -TypeName PSObject -Property @{  ​
    'Name' = 'Susan'
    'Age' = 32
}

See also

26 questions
0
votes
1 answer

Who can explain why the results of these two consoles are the same?

This is a constructor function,and it has two instance object,then I change them with different depth,but result I can't understand.if someone encounter this problem,hope you can help me,thanks. let C = function () {} C.prototype =…
0
votes
2 answers

New-Object vs [type]::New(), script vs ISE

Sigh. Another day, another PowerShell method interaction with .NET I just don't understand. This time with signed XML, but it's an issue with how to create a new object. $signedXml = New-Object system.security.cryptography.xml.signedXml…
Gordon
  • 6,257
  • 6
  • 36
  • 89
0
votes
0 answers

PowerShell Studio dynamic checkbox naming issue

giving the following PowerShell Studio Code, how can I call and disable the 'David Checkbox' under the 'Checkit' button. I know I am messing up on the checkbox declaration somehow because powershell does not recognize my checkbox as an object: The…
Didi
  • 1
0
votes
0 answers

SAPIEN PowerShell Studio: Issue with New-Object Checkbox regarding Name Assignation

I am fairly new with PowerShell New-Object System.Windows.Forms.CheckBox feature. What I would like to achieve is to create a form with different a dynamic object ( textbox,checkbox,label) The problem comes when I am trying to refer to the checkbox…
Didi
  • 1
0
votes
1 answer

Combining Get-ACL results into 1 object

Please excuse my beginner level powershell. I want to be able to combine the results of different results of Get-ACL into one object that'll later be exported At the very basic level all I want is to combine different results of different folders…
Lou
  • 25
  • 4
0
votes
1 answer

Why is this powershell script not deleting all Outlook Emails That Have Been Replied To?

I am writing this script to delete any Exchange quarantined emails that have already been replied to by another technician. It "works" but it only is deleting the first set of emails that it finds that have been replied to, the original plus the…
Todd Welch
  • 1,776
  • 2
  • 17
  • 23
0
votes
1 answer

Suppress output created by PowerShell New-Object

Suppress PowerShell output messages new outlook application object is created? $outlook = New-Object -ComObject outlook.application $outlookItem = $outlook.CreateItem("olMailItem") I already tried using these approaches. They did not work: …
Sherzad
  • 405
  • 4
  • 14
0
votes
1 answer

Instatiate Object inside for

I am instatiating an object outside For and changing value like this: NotaCaract dadosNota = aux.getListaNotasInicial().createNewNotaCaract(); for(int i=0; i< saida.getListaCompletaProds().size(); i++){ seqIdNota =…
0
votes
1 answer

Powershell custom class creation question

As I'm ramping up on PowerShell and exploring custom classes, I keep hitting this weird Exception that persists 'til I make any change. > PS C:\Users\Purpl_000> C:\PS\Node\NodeTest.ps1 Cannot convert the > "Node" value of type "Node" to type "Node".…
0
votes
1 answer

PS export specific fields from groups and sum of users and user attributes

Need to export overall groups info in particular OU (recursively) from Acitve Directory structure with these fields: OU | Groupname | GroupCategory | GroupScope | GroupMemberOf | GroupMembers (other groups,not users) | TotalUsers (if any) | …
VVl
  • 25
  • 5
-1
votes
1 answer

Powershell - convert new-object created with PSObject to number or integer

I have a script that uses APIs to pull data from our MDM about phone devices. It creates a .csv file with many columns. The IMEI column shows as (for instance) 3.343434+14 instead of showing 334343412345678912345. Can anyone help show me how to have…
bdjenky
  • 23
  • 1
  • 7
1
2