Get-Object or equivalent command

I'm working with some software and I'm needing to create a new COM object. I have a powershell script that uses "New-Object -ComObject" with all the settings to create this object. My question is how I can determine if this script has already been run. I have seen some articles refer to a Get-Object command, but Windows doesn't recognize that command. Is there any way I can see if I have already created this object on a specific machine?
Jason TenpennyNOC ManagerAsked:
Who is Participating?
 
Jason TenpennyNOC ManagerAuthor Commented:
I figured out what registry setting it was changing and am looking it up via the registry.
0
 
David SankovskySenior SysAdminCommented:
I don't see a Get-Object CMDLET on technet, but searching CMDLETs that are related to New-Object, I came across this one:
Select-Object. Perhaps it can help your cause.
0
 
ITguy565Commented:
you could try this :

$test = New-Object Psobject -Property @{  Testprop = "" }
if (($test | gm | select -exp name) -contains 'testprop' ) {"true"}
else { "false" }

Open in new window


reference : https://social.technet.microsoft.com/Forums/windowsserver/en-US/843e2734-d96f-4ce4-96d5-7b5a00b85eb9/check-object-property-existance?forum=winserverpowershell
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
ITguy565Commented:
change it to meet your needs as I don't know your object names.
0
 
David SankovskySenior SysAdminCommented:
Jason, If any of the question above helped you in the right direction, Please assign points as you see fit,
if you arrived on the solution completely on your own, that's great too, But please don't leave the question open, close it.
I'm glad that you resolved your issue though.
0
 
Jason TenpennyNOC ManagerAuthor Commented:
I've tried a couple of times to mark my own comment as the answer, but I keep getting an error every time.
0
 
David SankovskySenior SysAdminCommented:
I've open a request to a moderator, he should be able to assist.
0
 
Jason TenpennyNOC ManagerAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.