astralissomnium / powershell-no-library-just-functions Goto Github PK
View Code? Open in Web Editor NEWUsefull powerShell functions for people, that do not want to use a 3rd library
License: GNU General Public License v3.0
Usefull powerShell functions for people, that do not want to use a 3rd library
License: GNU General Public License v3.0
A README.md
file with informations and examples with description on the differences between the functions would be appreciated.
This is not an issue but a request, first thanks for the amazing script. It's the only one that can really go through subdirectories and get files.
I was wondering if we can add validation to check if the file exists on the remote FTP server to skip it and carry on. I noticed if the script has been terminated and I retry to run it, it starts over and overwrite the existing data so it consume so much time if the script was terminated. Thanks again and hopefully you read my message.
I'm trying to use the get-ftpchilditem from the ftpmodule but is not working.
Below the commented lines in the file to use as an example.
Both of them seem to have the option -ftpfilepath wrong since the function is expecting $ftpfolderpath.
#Get-FtpChildItem -ftpFilePath "ftp://myHost.com/root/leaf/" -userName "User" -password "pw" -hidden $false -File
#Get-FtpChildItem -ftpFilePath "ftp://myHost.com/root/leaf/" -userName "User" -password "pw" -Directory
function Get-FtpChildItem($ftpFolderPath, $username, $password, [System.Management.Automation.SwitchParameter]$file, [System.Management.Automation.SwitchParameter]$directory, $hidden = $true) {
If I run
Get-FtpChildItem -ftpFilePath "ftp://192.168.1.1/DIR/" -userName "User" -password "pw" -hidden $false -File
I get the follwoing error
Exception calling "Create" with "1" argument(s): "Value cannot be null.
Parameter name: requestUri"
At C:\scripts\modules\FTPModule.ps1:2 char:5
$ftprequest = [System.Net.FtpWebRequest]::Create($sourceuri)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The property 'Method' cannot be found on this object. Verify that the property exists and can be set.
At C:\scripts\modules\FTPModule.ps1:3 char:5
$ftprequest.Method = $method
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The property 'Credentials' cannot be found on this object. Verify that the property exists and can be set.
At C:\scripts\modules\FTPModule.ps1:4 char:5
$ftprequest.Credentials = New-Object System.Net.NetworkCredential ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\modules\FTPModule.ps1:79 char:5
$FTPResponse = $ftprequest.GetResponse()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\modules\FTPModule.ps1:80 char:5
$ResponseStream = $FTPResponse.GetResponseStream()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.IO.Streamreader.
At C:\scripts\modules\FTPModule.ps1:81 char:21
$StreamReader = New-Object System.IO.Streamreader $ResponseStream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\modules\FTPModule.ps1:82 char:5
$DirListing = (($StreamReader.ReadToEnd()) -split [Environment]:: ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\modules\FTPModule.ps1:83 char:5
$StreamReader.Close()
~~~~~~~~~~~~~~~~~~~~~
You cannot call a method on a null-valued expression.
At C:\scripts\modules\FTPModule.ps1:84 char:5
$FTPResponse.Close()
~~~~~~~~~~~~~~~~~~~~
Your Example isn´t correct:
#Get-FtpChildItemHidden -ftpFilePath "ftp://myHost.com/root/leaf/" -userName "User" -password "pw" -File -Directory
should be:
#Get-FtpChildItemHidden -ftpFolderPath "ftp://myHost.com/root/leaf/" -userName "User" -password "pw" -File -Directory
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.