Common COM objects in powershell (New-object)

Source: Internet
Author: User
Tags sql server management microsoft outlook

# Create a random number object instance:
$ Ran = new-Object System. Random
$ Ran. nextdouble ()

Sometimes, the class of the instance to be used is saved in an independent library file. powershell does not load by default, so you need to load the library file before creating the instance class:
Use the methods provided by the system. reflection. Assembly class to load the Class Library:
[System. reflection. Assembly]: loadwithpartialname ("system. Windows. Forms ")

The c: \ windows \ Assembly directory contains the available assembly:

Example: [system. reflection. Assembly]: loadwithpartialname ("taskscheduler ")

View available assembly:


Create instance class:
$ Balloon =New-Object System. Windows. Forms. policyicon

# Create a random number object instance:
$ Ran =New-Object System. Random
$ Ran. nextdouble ()

(New-object net. WebClient). Downloadstring ("http://live.com ")


The loadwithpartialname method is not suitable for use in a script or product release environment. It loads the latest library file, which may be different from the version used for development. The safer way to load the library file is to use [reflection. Assembly]: load () with the complete name.

 

Common COM objects:

Comadmin. comadmincatalog: Provides access and management of Windows COM borders.

Excel. Application: Allows automation of Microsoft Excel and Its Interaction

Excel. Sheet: allows interaction with Excel worksheet

Hnetcfg. fwmgr: provides access to the Windows Firewall Management Function

Htmlfile: allows interaction with a new Internet Explorer document

Mapi. Session: provides access to sessions of mapi (Message application programming interface), such as folders, emails, and address books.

Microsoft. Update. AutoUpdate: Manages automatic update plans for Microsoft Update.

Microsoft. Update. Installer: allows you to install updates from Microsoft Update.

Microsoft. Update. Session: provides access to information about the Microsoft Update local history.

Microsoft. Update. systeminfo: provides access to information related to Microsoft Update in the current system.

Mmc20.application: Allows automation and interaction of the Management Console (MMC)

Msscriptcontrol. scriptcontrol: allows evaluation and control of wsh scripts

Msxml2.xsltemplate: Allows XSL Conversion

Outlook. Application: allows interaction and automation with your Microsoft Outlook applications, such as emails, calendars, and contacts.

Outlookexpress. messagelist: allows interaction and automation with your email via Outlook expresshe

PowerPoint. Application: allows automatic Microsoft PowerPoint and Interaction

Scripting. FileSystemObject: provides access to the computer's File System

Scriptpw. Password: a plain text password that can be input in disguise. If possible, avoid using this password. The read-host-assecurestring parameter should be given priority.

Shell. Application: provides access to Windows Explorer Shell applications, such as management windows, file box folders, and current sessions.

Shell. localmachine: provides access to information about the management of the current computer and Windows shell program.

Shell. User: Provides windows session and configuration file access for the current user.

Sqldmo. sqlserver: provides access to the Microsoft SQL server management function.

Word. Application: allow interaction and automation with Microsoft Word

Word. Document: allows interaction with Microsoft Word documents

Wscript. Network: provides access to the Windows environment of the Internet, such as printers, network drives, and computer and domain information.

Wscript. Shell: provides access to Windows shells, such as applications, shortcuts, environment variables, registries, and operating environments.

Wshcontroller: run the wsh script on a remote computer.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.