Search: 
NetCmdlets - Getting Started

/n software NetCmdlets is a suite of Windows PowerShell cmdlets that give you powerful network communications capabilities including network management, instant messaging, file transfer, remote execution, email management, and more.

NetCmdlets is for IT professionals, developers, and power users. No programming or scripting experience is necessary.

Some of the cmdlets included in NetCmdlets:

  • send-email
  • get-pop
  • get-imap
  • get/set-ldap
  • get/send-http
  • get/send-ftp
  • get/set-snmp
  • get-time
  • send-im
  • send-sms
  • send-rexec
  • send-ssh
  • And many more...

Installation

The installation of NetCmdlets includes many command line tools (cmdlets), demos, and documentation for each cmdlet. After the installation is complete, you can either start PowerShell using the "Windows PowerShell with NetCmdlets" shortcut created by the setup, or you can start PowerShell manually and add NetCmdlets to the console runtime from the command line as shown below. If you plan to use NetCmdlets often, consider putting this line in your PowerShell Profile:

PS C:\>add-pssnapin NetCmdlets

Examples

Several demo PowerShell scripts are installed in the \nsoftware\NetCmdlets\demos subfolder of Program Files. It might be a good idea to give some of these a quick try just to get an idea of what you can do with NetCmdlets. Also be sure to look at the help file (\nsoftware\NetCmdlets\nsoftware.NetCmdlets.chm, or use get-help).

Here are some examples of NetCmdlet use:

  • Email

    The send-email cmdlet is used to connect to your smtp-server and send outgoing emails. It supports both file attachments and html messages, and it will connect with any smtp-server you point it to, including secure (ssl) servers. For a full list of parameters supported by send-email, please see the documentation (get-help send-email). A simple example:

    PS C:\>send-email -server myserver -to you@server.com -from me@server.com 
    -message "How are you today?" -subject "test email"

    From, To, and Server are all required arguments. If you don't know your mail server address you can use the get-mx cmdlet to find the mail server for any given email address.

    There are two NetCmdlets that can be used for receiving email: get-pop and get-imap, for POP and IMAP mail servers, respectively.

    PS C:\>get-pop -server mailserver -user lance -password mypassword
    PS C:\>get-imap -server mailserver -user lance -password $mypassword

    Plug-in your own mailserver, username, and password to get a collection of objects describing your own inbox. As with all of the TCP/IP NetCmdlets, get-pop and get-imap support connecting to secure servers using SSL. Here's an example for connecting securely to and retrieving messages from the gmail pop server, try it with your own Gmail account:

    PS C:\> get-pop -server pop.gmail.com -user username -password password 
    -ssl implicit -port 995
  • Messaging

    Besides send-email, there are several other "send" NetCmdlets used for inter-personal communication including send-im and send-sms. The send-im NetCmdlet sends an instant message using the XMPP (Jabber) messaging protocol. The send-sms NetCmdlet sends a mobile text message over the SMPP (SMS) protocol. These two cmdlets have very similar syntaxes, like so:

    PS C:\>send-sms -server smpp.clickatell.com -port 2345 
    -recipient 19195555555 -user username -password mypass
    -message "call me!" PS C:\>send-im -server myserver -user test@myserver -password test -recipient lancer@myserver -message "Hello there"
  • File Transfer

    There are several NetCmdlets that can be used for file transfer such as get/send-ftp, get/send-tftp, get-http, get/send-webdav, and more. Probably the most commonly used file transfer method is still FTP. The get-ftp and send-ftp NetCmdlets are used to download and upload files from an FTP server. Below is an example of using get-ftp to download a file from ftp.microsoft.com and then send-ftp to upload it to another ftp server on my local network:

    PS C:\>get-ftp -server ftp.microsoft.com -user anonymous 
    -password lance@ -localfile C:\readme.txt -remotefile /deskapps/readme.txt PS C:\> set-ftp -server 10.0.1.1 -user test -password kotplot
    -localfile C:\readme.txt -remotefile readme.txt

  • Network Management

    Get/send-snmp, send-trap, get/set-ldap, send-rexec, send-rshell, send-ssh, send-syslog, get-packet, get-time, get-trace, are all examples of NetCmdlets that are used for network management.

    Here are a few examples of common network management tasks:

    To authenticate a user with your Active Directory installation:

    PS C:\>get-ldap -server ldapserver -binddn DOMAIN\lance 
    -password mypassword

    To find SNMP enabled devices on your network:

    PS C:\>get-snmp -agent 255.255.255.255 -oid sysName.0

    To find SNMP enabled devices on your network and email them to you:

    To send commands to remote execution services:

    PS C:\>send-rexec -server myserver -user myuser -password mypassword 
    -command "test.exe" PS C:\>send-rshell -server myserver -user myuser
    -command "C:\WINDOWS\system32\cmd.exe /c dir c:\"


    PS C:\>send-ssh -server myserver -user myuser -password mypassword
    -command ls

NetCmdlets

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team.

| About | Privacy Policy | Terms of Use |
© Copyright 2008 /n software inc.