Getting Started



/n software NetCmdlets are 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:

  • Get/Send-FTP
  • Get/Send-SFTP
  • Get/Send-SCP
  • Get-POP
  • Get-IMAP
  • Get/Set-LDAP
  • Get-HTTP
  • Get/Set-SNMP
  • Invoke-SSH
  • Invoke-Telnet
  • Get-S3
  • And many more…

Installation

The installation of NetCmdlets includes many command line tools (cmdlets), demos, and documentation for each cmdlet. During installation you will have the option to let the setup modify your PowerShell profile to automatically import the NetCmdlets module. When the setup is complete simply open PowerShell as normal and you will have all of the cmdlets available to you.

If you wish to manually import the module instead, simply run the command:

PS> Import-Module NetCmdlets

Examples

Several demo PowerShell scripts are created in the “demos” folder of the installation. It is suggested to take a look at the demos here to get an idea of what you can do with NetCmdlets. Also be sure to look at the help file (Available as a link from the start menu, installed in the “help” folder of the installation, and available via get-help).

Here are some examples of NetCmdlet use:

  • Email
    The Send-Email cmdlet is used to connect to an SMTP server and send 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> 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.
    There are two NetCmdlets that can be used for receiving email: Get-Pop and Get-Imap, for POP and IMAP mail servers respectively.

    PS> Get-Pop -Server mailserver -User johndoe -Password mypassword
    PS> Get-Imap -Server mailserver -User johndoe -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 is an example for connecting securely to and retrieving messages from the Gmail pop server, try it with your own Gmail account:

    PS> Get-Pop -Server pop.gmail.com -User username@gmail.com -Password password
    -SSL implicit -Port 995
  • File Transfer
    There are several NetCmdlets that can be used for file transfer such as Get/Send-FTP, Get/Send-SFTP, Get/Send-SCP, Get-HTTP, and more. The most commonly used file transfer method is 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 a local network:

    PS> Get-FTP -Server ftp.microsoft.com -User anonymous
    -Password JohnDoe@ -LocalFile readme.txt -RemoteFile /deskapps/readme.txt

    PS> Send-FTP -Server YourServer -User test -Password test
    -LocalFile readme.txt -RemoteFile MyFolder/readme.txt

  • Network Management
    Get/Set-SNMP, Send-Trap, Get/Set-LDAP, Invoke-Rexec, Invoke-Rshell, Invoke-SSH, Invoke-Telnet 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> Connect-Ldap -Server ldapserver -BindDN DOMAIN\JohnDoe -Password mypassword

    To find SNMP enabled devices on your network:

    PS> Get-SNMP -agent 255.255.255.255 -OID sysName.0

    To send commands to remote execution services:

    PS> Invoke-Rexec -Server myserver -User myuser -Password mypassword -Command ls

    PS> Invoke-Rshell -Server myserver -User myuser
    -command “C:\WINDOWS\system32\cmd.exe /c dir c:\”

    PS> Invoke-SSH -Server myserver -User myuser -Password mypassword -Command ls

  • 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 syntax:

    PS> Send-SMS -Server smpp.clickatell.com -Port 2345
    -Recipient 19195555555 -User username -Password mypass
    -Message “call me!”

    PS> Send-IM -Server myserver -User test@myserver -Password test
    -Recipient johndoe@myserver -Message “Hello there”