Function parameter usage inside Begin block

Ok, pulling my hair out a bit here. Is it possible to access content in the pipeline from a begin block? Ex: function New-AwesomeFunction { [cmdletbinding()] Param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [psobject]$sweetPipelineStuff ) begin { Write-Output $sweetPipelineStuff.insideFluff } <# other stuff #> } Here’s the odd thing – if I run Write-Host $_.sweetPipelineStuff within the begin […]

Formatting help for pscustomobject output

Hey guys, I’ve found this handy script to help me enumerate the local admins on my network. It works quite fine, but I’m having an issue with the output. It goes like this: Get-ADComputer -filter * | foreach { $members = Get-LocalGroupMember -Name ‘Administrators’ -ComputerName $_.Name [pscustomobject]@{ ‘ComputerName’ = $_.Name ‘Members’ = $members } } […]

Send command remotely to an IP range

Hi I am trying to make a script to run a command (gpupdate /force) on an IP range My script so far only returns no hostname found for each IP: $listofIPs = 1..254 | % {“10.12.20.$_”} foreach ($ip in $listofIPs) { $result = $null $ErrorActionPreference = “silentlycontinue” $result = [System.Net.Dns]::gethostentry($ip) If ($result) { try{ if […]

Help with PS script We are upgrading our VMware Mirage from 4.3 to 5.9.1 and also moving to Windows 10. Mirage no longer supports sysprep during it’s baselayer provisioning so we are running into SID duplication. We are running generalize SYSPREP after the baselayer. The unattended xml adds the computer to the domain and enables admin. Once the […]