Quicklinks
NOTE: ActiveXperts Network Monitor ships with a large collection of PowerShell scripts to monitor any aspect of your network. Most PowerShell scripts also have a VBScript implementation. Download Now »
You can use any of the Powershell programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
################################################################################# # ActiveXperts Network Monitor PowerShell script, © ActiveXperts Software B.V. # For more information about ActiveXperts Network Monitor, visit the ActiveXperts # Network Monitor web site at http://www.activexperts.com ################################################################################# # Script # TFTP.ps1 # Description: # Check for file existence on a TFTP host # This function uses the ActiveSocket Toolkit, an ActiveXperts product. # ActiveSocket is automatically licensed when ActiveXperts Network Monitor is purchased # For more information about ActiveSocket, see: www.activexperts.com/network-component # Parameters: # 1) strHost - Host name or IP address of the TFTP host # 2) strFile - The file to check # Usage: # .\TFTP.ps1 "" " " # Sample: # .\TFTP.ps1 "10.1.1.100" "/music/song001.mp3" ################################################################################# # Parameters param ( [string]$strHost, [string]$strFile ) cls # Check paramters input if( ([string]$strHost -eq "") -or ([string]$strFile -eq "") ) { $res = "UNCERTAIN: Invalid number of parameters - Usage: .\TFTP.ps1 " echo $res exit } # Create object $objTftpServer = new-object -comobject ActiveXperts.TftpServer $objFileSystem = new-object -comobject Scripting.FileSystemObject ################################################################################# # THE SCRIPT ITSELF ################################################################################# # Use binary transfer $objTftpServer.BinaryTransfer = $true # Use default port 69 $objTftpServer.HostPort = 69 $strTempFile = $objFileSystem.GetSpecialFolder(2).Path + "\" + $objFileSystem.GetTempName() # Get file $objTftpServer.Get( $strHost, $strFile, $strTempFile ) if( $objTftpServer.LastError -eq 0 ) { return "SUCCESS: File [" + $strFile + "] found on TFTP host [" + $strHost + "]; size =" + $objTftpServer.BytesReceived + " bytes DATA: 1" } else { return "ERROR: File [" + $strFile + "] not found on TFTP host; result=[" + $objTftpServer.LastError + ": " + $objTftpServer.GetErrorDescription( $objTftpServer.LastError ) + "] DATA:0 " } if( $objFileSystem.FileExists( $strTempFile ) ) { $objFileSystem.DeleteFile($strTempFile) }