none
Creating new file on remote system RRS feed

  • Question

  • Hi have run below code on PowerShell

    $DriveLetter=new-item -path 'c:\TestFolder' -name TestFile.txt -type 'file' -value 'from code ' -Force
    $securePassword = ConvertTo-SecureString "MyPassword" -AsPlainText -force
    $credential = New-Object System.Management.Automation.PsCredential("myusername",$securePassword)
    Invoke-WmiMethod -ComputerNam MyComputerName -Class Win32_Process -Name Create -ArgumentList "$($DriveLetter)" -Credential $credential

    It return following

    __GENUS          : 2
    __CLASS          : __PARAMETERS
    __SUPERCLASS     : 
    __DYNASTY        : __PARAMETERS
    __RELPATH        : 
    __PROPERTY_COUNT : 2
    __DERIVATION     : {}
    __SERVER         : 
    __NAMESPACE      : 
    __PATH           : 
    ProcessId        : 
    ReturnValue      : 9
    PSComputerName   : 

    And I am not geeting textfile at specified loactaion pls help...

    Thursday, October 3, 2013 1:34 PM