# 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.