Author Posts

November 20, 2016 at 9:22 pm

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}

November 20, 2016 at 9:44 pm

Cannot find the type for custom attribute 'CmdletBidning'

That's a typo. It's

[CmdletBinding()]

December 3, 2016 at 6:26 pm

Thank you so much!!