help with the function that will work on remote computers with the icacls co

Welcome Forums General PowerShell Q&A help with the function that will work on remote computers with the icacls co

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 2 months ago.

  • Author
    Posts
  • #58262

    Participant
    Points: 0
    Rank: Member

    Hello,
    I am new to powershell. I am trying to write a function that will work on remote computers with the icacls command. The icacls command works find on the local computer. But I would like to process multiple computers at once.

    I am getting this error: Cannot find the type for custom attribute 'CmdletBidning'. Make sure that the assembly that contains this type is loaded.

    Can you please help

    Function Set-Permissions {
    [CmdletBidning()]
    param([Parameter(Mandatory=$true,
    ValueFromPipeline=$true,
    ValueFromPipelineByPropertyName=$true)]
    [Alias('hostname')]
    [string[]$CommputerName,
    [switch]$nameLog
    )
    BEgin {}
    Process {
    foreach ($computer in $computername)
    {
    #write-host $computer
    icacls E:\ /grant TESTTARGET\TEST.Administrators:(OI)(CI)F
    icacls F:\ /grant TESTTARGET\TEST.Administrators:(OI)(CI)F
    icacls "E:\Includes" /setowner TESTTARGET\test.svc /t /c
    icacls "E:\ADMS" /setowner TESTTARGET\test.svc /t /c
    icacls "E:\Program Files" /setowner TESTTARGET\test.svc /t /c
    icacls "F:\Software" /setowner TESTTARGET\test.svc /t /c

    }

    }

    End {}

    }

    Set-Permissions -computername .\computers
    Invoke-Command -ComputerName (Get-Content ".\Computers.txt") -ScriptBlock {Set-Permissions}

  • #58264

    Participant
    Points: 41
    Rank: Member

    Cannot find the type for custom attribute 'CmdletBidning'

    That's a typo. It's

    [CmdletBinding()]
  • #59307

    Participant
    Points: 0
    Rank: Member

    Thank you so much!!

The topic ‘help with the function that will work on remote computers with the icacls co’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort