Create object for a class in PowerShell script

Create object for my class in PowerShell script

Please follow the below steps to create an object in your Powershell script:

Using load file [Reflection.Assembly]::LoadFile(<Compleate Path of dll>), 
  1. Call static methods in the following way
    [namespacename.classname]::methode()
  2. Call non-static methods by creating objects
    $newobject = New-Object namespacename.classname
    $newobject.methode()
Click here to view a sample plugin file using PowerShell script.


    • Related Articles

    • How to increase the Script Execution Timeout value for plugins

      If a plugin's script execution time exceeds the Script Execution Timeout value configured in Site24x7, it could result in errors during plugin installation or disrupt the polling for existing plugin monitors. In such cases, you need to extend the ...
    • How to troubleshoot my Windows PowerShell Plugin?

      By default, the Site24x7 monitoring Windows agent will run as a SYSTEM user. In case, if you would like to verify if the plugin script is giving the output properly as SYSTEM user, follow these steps: Download PsExec from this link and extract the ...
    • Error message "Invalid WMI class" on computers running on Windows 7 or Windows server 2008 R2

      WMI is a component that is used for collecting metrics like CPU/memory/disk usage in the server. If the WMI component is corrupted, it will not be able to collect any data from the server. Please perform the following steps to check if the WMI ...
    • Open/Import web script to Web Transaction (Browser)

      A web script is a file that contains all the transactions recorded using the Site24x7 Web Transaction (Browser) tool.  To open web script to the Web Transaction (Browser) tool,f you've recorded the script using the Site24x7 Web Transaction (Browser) ...
    • How to create a service account in the GCP console?

      A service account as a JSON file is required to authenticate Site24x7 to perform GCP resource discovery and monitoring. To create a service account, follow the steps below: Log in to your GCP console and click on the hamburger icon at the top left ...