Jason Tenpenny
asked on
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?
you could try this :
reference : https://social.technet.microsoft.com/Forums/windowsserver/en-US/843e2734-d96f-4ce4-96d5-7b5a00b85eb9/check-object-property-existance?forum=winserverpowershell
$test = New-Object Psobject -Property @{ Testprop = "" } if (($test | gm | select -exp name) -contains 'testprop' ) {"true"} else { "false" }
reference : https://social.technet.microsoft.com/Forums/windowsserver/en-US/843e2734-d96f-4ce4-96d5-7b5a00b85eb9/check-object-property-existance?forum=winserverpowershell
change it to meet your needs as I don't know your object names.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
I've tried a couple of times to mark my own comment as the answer, but I keep getting an error every time.
I've open a request to a moderator, he should be able to assist.
ASKER
it's super generic.
Screen-Shot-2018-05-14-at-3.20.46-PM.png
Screen-Shot-2018-05-14-at-3.20.46-PM.png
Select-Object. Perhaps it can help your cause.