firstly powershell skills limited please gentle ;-)...
so i've built 4 or 5 runbooks using microsoft orchestrator run remote powershell scripts various simple exchange tasks, such setting outofoffice reply, enabling mailboxes, creating shared mailboxes various permissions etc. had been using same basic connection structure/method these works fine, ie
$exchangecas = "<casservername>" $session = new-pssession -configurationname microsoft.exchange -connectionuri http://<casservernamefqdn>/powershell/ import-pssession $session <script body exchange cmdlets> remove-pssession $session
however, i'm trying create additional runbook automatically add ip addresses relay our 4 hub servers - pretty basic script (that dug out/tweaked internet) not working when run orchestrator. work fine when run powershell ise on server has exchange tools installed, , fact other exchange (similar) scripts work @ least rule out permissions issues orchestrator service account executing script. reference below full script i'm trying run orchestrator .net activity , testing using powershell ise on orchestrator server:-
$exchangecas = "<excas>" $session = new-pssession -configurationname microsoft.exchange -connectionuri http://<excasfqdn>/powershell/ import-pssession $session # receive connectors update $listofips = import-csv \\<targetserver>\d$\psscripts\mailboxrightsscript\scorch\addiplist.txt $reccons= get-receiveconnector | {$_.name -match"anonymous relay"} foreach ($reccon in $reccons) { write-host "updating", $reccon.identity foreach($line in $listofips) { $reccon.remoteipranges +=$line.ip } set-receiveconnector $reccon -remoteipranges $reccon.remoteipranges } remove-pssession $session
the error can see orchestrator server ise below:
cannot process argument transformation on parameter 'identity'. cannot convert "\anonymous relay" value of type "deserialized.microsoft.exchange.data.directory.systemconfiguration.receiveconnector" type "microsoft.exchange.configuration.tasks.receiveconnectoridparameter".
from trawling through articles seems issue how data passed between local , remote powershell , 'hydration' of objects. tbh lot of detail of discussions bit on head when comes powershell, not wishing lazy able provide powershell script solution based on trying above can run .net activity orchestrator add ip address/addresses (prefer input file) relay. know if solution modified remove address relay aswell.
any appreciated...
use server distinguish name. work
set-receiveconnector $reccon.distinguishname -remoteipranges $reccon.remoteipranges
Comments
Post a Comment