Getting some odd stuff with SMA and hopefully someone has encountered this before. Briefly, I'm creating a ticket, applying a template to overwrite it, then pulling the object. Later on I'll be using the object to apply user relationships to it and description changes. What's annoying is that if I launch this as a job in SMA it works, if I run it through the ISE console with the SMA ISE add-on it works, but when I call this with another runbook it errors out with, "A parameter cannot be found that matches parameter name 'eq'. (A parameter cannot be found that matches parameter name 'eq'.)" It's breaking at: $SRProjection = Get-SCSMObjectProjection -ProjectionName $SRTypeProjection.Name -filter “ID -eq $SRID” @connection It seems to want a GUID for this filter but when running the get-scsmobjectprojections and selecting any of those objects, none have ID in GUID format (((( code:
Submarine Sandpaper fucked around with this message at 21:18 on Oct 26, 2018 |
|
# ¿ Oct 26, 2018 19:44 |
|
|
# ¿ Apr 29, 2024 04:58 |
When I purposefully break it by putting an invalid ID and run it manually the exception is asking for a GUID. /E without writing the property ID, the ID that's generated for the exception just lacks SR so it's not even a guid. Submarine Sandpaper fucked around with this message at 14:46 on Oct 27, 2018 |
|
# ¿ Oct 27, 2018 14:44 |
PBS posted:From the error it sounds like it doesn't like your filter. writeErrorStream : True PSMessageDetails : Exception : Microsoft.PowerShell.Commands.WriteErrorException: A parameter cannot be found that matches parameter name 'eq'. TargetObject : CategoryInfo : InvalidData: ( [Write-Error], Error Creating Service Request FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Create-SCSMServiceRequest ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Create-SCSMServiceRequest, C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandbo xes\yteug04o.u1l\temp\srycaoqe.mpc\Create-SCSMServiceRequest.ps1: line 192 at <ScriptBlock>, C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\yteug04o .u1l\temp\srycaoqe.mpc\Create-SCSMServiceRequest.ps1: line 198 at <ScriptBlock>, <No file>: line 38 PipelineIterationInfo : {0, 0} /e- changed the filter syntax to {(logic)} and got: exception property (property) output writeErrorStream : True PSMessageDetails : Exception : Microsoft.PowerShell.Commands.WriteErrorException: property TargetObject : CategoryInfo : InvalidData: ( [Write-Error], Error Creating Service Request FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Create-SCSMServiceRequest ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Create-SCSMServiceRequest, C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandbo xes\yteug04o.u1l\temp\rpg2k2z4.dsv\Create-SCSMServiceRequest.ps1: line 192 at <ScriptBlock>, C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\yteug04o .u1l\temp\rpg2k2z4.dsv\Create-SCSMServiceRequest.ps1: line 198 at <ScriptBlock>, <No file>: line 38 PipelineIterationInfo : {0, 0} /e- first error when chaning ID to display name so it's not the guid Submarine Sandpaper fucked around with this message at 15:10 on Oct 29, 2018 |
|
# ¿ Oct 29, 2018 14:53 |
anthonypants posted:Is this line 192 or 198? 192 is the error catch, 198 is the call to the create-scsmservicerequest function. That helped though, was (and I hope I'm done with this) able to fix it by: code:
|
|
# ¿ Oct 29, 2018 16:59 |
aws s3 cp "`"$line`"" "`"$newline`"" those are the escapes you need if i'm reading you right. surround in more quotes if you're using it like a filter string. Submarine Sandpaper fucked around with this message at 01:05 on Nov 1, 2018 |
|
# ¿ Nov 1, 2018 00:58 |
I was told to do this after a review and don't think it's possible but want to confirm before ignoring it. Old code:
New code:
|
|
# ¿ Nov 12, 2018 18:13 |
Call Script was a generic and I should have written call-function, $ExecutionContext.InvokeCommand.ExpandString($description) ended up working out. Hope I won't forget this one. Submarine Sandpaper fucked around with this message at 18:51 on Nov 12, 2018 |
|
# ¿ Nov 12, 2018 18:41 |
Jowj posted:What issue is moving the line out of the foreach block solving? I'm sort of confused as to what the end goal is.
|
|
# ¿ Nov 12, 2018 20:22 |
What's the best way to terminate a script not using throw or exit?
|
|
# ¿ Nov 30, 2018 22:59 |
if it's looking for a dict @ that @{RunningMode=AUTO_STOP,RunningModeAutoStopTimeoutInMinutes=60,RootVolumeSizeGib=80,UserVolumeSizeGib=50} Anyone have experience using ROBO copy from SMA to remote fileshares? I'm having a bitch of a time. Looking to just get number of files in a specific user's share. Gotta use a PSSession somehow due to rights over the shares.
|
|
# ¿ Jan 29, 2019 19:39 |
thebigcow posted:
Turns out permissions are the issue. SMA is service manager automation. To my understanding it's like in house azure.
|
|
# ¿ Jan 30, 2019 14:24 |
FISHMANPET posted:Maybe I'm not quite understanding, because if you set the ValidateSet to only $True then you can't do -param:$false. Now granted, setting switches to true by default is apparently against best practice so I guess it's kind of weird that I'm asking "what's the best way to follow best practices when I'm violating best practices." code:
Submarine Sandpaper fucked around with this message at 20:46 on Feb 20, 2019 |
|
# ¿ Feb 20, 2019 20:24 |
you can pass via the AD user's sid rather than their sAm Also (if it's working this probably doesn't matter) but powershell has get-acl and set-acl so you don't need to use the .*AcessControl() methods. Otherwise have you noticed if your intermittent failures are where the user already has permissions? I had a project shelved just adding permissions since it could potentially be too resource intensive if the stars aligned to gently caress up backups. I may have also been fed a crock of poo poo.
|
|
# ¿ May 24, 2019 19:41 |
Sometimes powershell just fucks up. I have the following:code:
|
|
# ¿ May 25, 2019 18:06 |
Invoke-RestMethod has a flag for -usedefaultcredentials which to my understanding will act as a passthrough. You also have the -SessionVariable parameter which'll create a variable you can then use with further requests via the -webvariable parameter. TBH I've really only used the -sessionvariable and -webvariable with generic invoke-webrequests though. favorite primer, I dunno, a lot is specific to the API i.e. you need to call any request and get a session token from the expected error's exception method.
|
|
# ¿ Aug 21, 2019 18:56 |
I'm having some regex issues and the various online calcs are not helping me resolve. Looking to determine if doing a cleanup is worthwhile and I want to see how much is cleaned up if it is. Creating the txt with: $DISMAnalyze = & "Dism.exe" /Online /Cleanup-Image /AnalyzeComponentStore and $DISMAnalyze is a system.string. Will have an expected output like the below: code:
Even something simple like $DismAnalyze.ToString() -match '[0-9]*\.[0-9]*\s\wB' is giving me a false. For whatever reason I still have to .ToString() it to get a return with -match, whether true or false. Online calcs are saying this should return all instances of *.* GB or *.* MB. I'm going crazy.
|
|
# ¿ Oct 30, 2019 17:12 |
Thanks y'all
|
|
# ¿ Oct 30, 2019 21:40 |
That makes me think, how useful is the built in convert fromsecurestring if you don't have a vault service or otherwise to pull central creds from?
|
|
# ¿ Feb 17, 2020 17:54 |
This is a silly one but how can you determine all the stores on a machine eg sqlserver, certificates, registry
|
|
# ¿ Mar 18, 2020 20:31 |
Is there a handy shorthand for getting array objects as values in a hashtable into an array without messing around out-string or some -join command to avoid the string conversion giving a system.object.whatever?
|
|
# ¿ Apr 29, 2020 19:01 |
Oh I half assed my question. Specifically when converting to CSV it attempts to .tostring() everything so if $hashtable is a value in an array that field returns System.Collections.Hashtable. So when I'm building my report I'm doing some absurd poo poo like ($hashtable | Out-String).trim() Submarine Sandpaper fucked around with this message at 04:34 on Apr 30, 2020 |
|
# ¿ Apr 30, 2020 04:31 |
TITANKISSER69 posted:I have 50 security groups that I need to add 2 users to the Delivery Management list so they can send to all of them. They're all in the format companyname.office.cityname, is it possible to add user1@company.com and user2@company.com to the allowed senders for companyname.office.* ? if I"m reading right: Set-Mailbox -Identity "Robin Wood" -AcceptMessagesOnlyFrom "Lori Penor","Jeff Phillips" -AcceptMessagesOnlyFromDLMembers "Legal Team 1" https://docs.microsoft.com/en-us/exchange/recipients/user-mailboxes/message-delivery-restrictions?view=exchserver-2019
|
|
# ¿ May 27, 2020 16:35 |
if your csv/text file is something like 1337 6969 420 then use get-content
|
|
# ¿ Jun 14, 2020 12:18 |
Yeah, set-aduser user -manager manager
|
|
# ¿ Oct 23, 2020 18:05 |
Read up on the get-aduser documentation, most properties can be filtered as a parameter rather then piping into a where. You can use -searchscope to specify OU. Pipe the result from this when it looks good to set-aduser -manager manager
|
|
# ¿ Oct 23, 2020 18:37 |
code:
I want it to work because of: code:
|
|
# ¿ Nov 2, 2020 23:33 |
ah that explains the error on my personal and the read-only exception. But it's still an error on the client's machines: Exception calling "SetAllowTSConnections" : "Invalid Operation" Hopefully it just won't be needed for this client's task I think these folks have an AV that's been sold to me as blocking all this and I don't have the keys to prevent that.
|
|
# ¿ Nov 3, 2020 01:37 |
purge the klist and see if there are any other creds stored.
Submarine Sandpaper fucked around with this message at 18:18 on Dec 22, 2020 |
|
# ¿ Dec 22, 2020 18:11 |
Can you do what you want to do with the data using a -parallel switch anywhere without jumping through these hoops? I see what you want to do and there's just gotta be a better way.
|
|
# ¿ Feb 18, 2021 22:20 |
Eh I wouldn't like to do this but it's not a hard solution. Since you know your tax/shiping/handling is always multiplied by the occurance of the order you can just divide that out. $math = $CSVfile | group order -NoElement [...] @{Name='Taxes' ;Expression={$_.Values[2] / $math[$math.values.IndexOf($_.Values[0])].Count}}, ` [...] /e thinking about it more you probably will want to rebuild the data so maybe not as easy as just doing a calculation in the expression Submarine Sandpaper fucked around with this message at 22:19 on Feb 6, 2022 |
|
# ¿ Feb 6, 2022 22:02 |
return will leave the loop if you have a successful first run
|
|
# ¿ Mar 19, 2022 17:46 |
ACLs sorta suck unless they've changed things in PowerShell. Last I did it I needed to be a local file system admin and you needed to pull the acl, modify it, then set via a method. Local admin maybe a lie but I thought i needed it for some reason. You may be best set by using old cmd liners and invoking them on a directory.
|
|
# ¿ May 25, 2023 01:08 |
Pile Of Garbage posted:lmao you're right I'm dumb as poo poo! I've no idea why I thought that was allowed. Short names?
|
|
# ¿ May 26, 2023 00:41 |
|
|
# ¿ Apr 29, 2024 04:58 |
Microsoft really does not want email admins to effect or read mailboxes, that's getting all swept to the compliance side of MS admin. I still mourn my inability to use search-mailbox. You still need to know your dates and all, you could setup an ICAL invite that books all holidays.
|
|
# ¿ Dec 12, 2023 20:15 |