Forum Widgets
Latest Discussions
Remote execution with exchange powershell
I'm trying to extract the primarysmtpaddress of each member of a distribution group from an exchange server in a remote forest. The bulk of the script is something link this $parameters = @{ ConfigurationName = 'Microsoft.Exchange' ConnectionUri = 'http://srvwex.company.local/powershell' Credential = $sourceCred # Authentication = 'Basic' ScriptBlock = {{(Get-DistributionGroup $args[0] |Get-DistributionGroupMember).PrimarySmtpAddress }} ArgumentList = $DG.Alias } $RemoteMembership=(Invoke-Command @parameters) but I got the following error The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode. + CategoryInfo : ParserError: ({(Get-Distribut...rySmtpAddress }:String) [], ParseException + FullyQualifiedErrorId : ScriptsNotAllowed Running the command (Get-DistributionGroup distributiongroup | Get-DistributionGroupMember).PrimarySmtpAddress locally on the remote exchange server obviously works Is there a way I can do it ? thanksSolvedStefanoC66Nov 29, 2024Brass Contributor46Views0likes1CommentNewbie here...
Using Windows 11 Pro version 23H2 ... Am trying to use the Mount-DiskImage command to mount an .iso file, but can't figure out how to do it assigning it a specific drive letter... it seems that it automatically assigns either the next available or -NoDriveLetter (using this parameter) Can Anyone direct me how to accomplish this???SolvedCesarChenNov 14, 2024Copper Contributor43Views0likes3Commentsscript to use PowerShell to Report Teams Status, Presence and Reset After Time
I would like to create a powershell script to run against my tenant to report where people have got a Reset Status After time coded in Teams Any suggestions - greatfully received. I can only find commands to show presence.SolvedBridget_TNov 12, 2024Brass Contributor82Views0likes5CommentsRemove a comma from a CSV file for a particular column only
Hi everyone I have a CSV file that has some bad data in a particular column called ColumnA. ColumnA is a column of names. Some of the names have a comma in it. For example, "Invesco QQQ Trust, Series 1". This extra comma is causing issues when I try to import the file because the delimiter is a comma too (ie CSV). The extra comma in the name needs to be removed. The file is a CSV so commas are needed. I need a Powershell script that removes commas for a particular column (ie ColumnA) and only those commas that are not at the beginning or end of the word. For example: ",Invesco QQQ Trust, Series 1," becomes ",Invesco QQQ Trust, Series 1," The leading and lagging commas are still needed in order to preserve the structure of the CSV. How can I do this in Powershell? Thank you in advance cc: LainRobertsonSolvedmanny213Nov 09, 2024Copper Contributor89Views0likes8CommentsRemove characters from a file name
Hi everyone I have a bunch of CSV files in a folder that need to be cleaned up. Both the file name and file contents have unneeded apostrophes. I need the apostrophes removed from the file name only. Leave contents untouched. For example, c/test/samp'le.csv becomes c/test/sample.csv. c:/test/Ol' Home.csv becomes c:/test/Ol Home.csv The script needs to look at each file in a given folder and remove the apostrophe if it finds one. Not every filename will have an apostrophe in it. The apostrophe can be anywhere in the name (beginning, end, middle of filename). How would I do this in Powershell? Thank youSolvedmanny213Nov 08, 2024Copper Contributor49Views0likes7CommentsHow do I permanently store module?
Hi everyone, I'm new to powershell, I would like to know how to automatically load the modules I load with import-module in each instance; if I load the modules with import-module, when I close the instance I lose the module. I would like to know how to permanently load, for example, the KPI module in the $Env:PsModulePath variable. Obviously the question is answered to all the modules that I always want to keep in section even when I start the computer. I hope for an answerSolvedmarika-9-5Nov 03, 2024Copper Contributor148Views0likes5Commentschange the primary address (prefix) distribution list group
change the prefix on the primary address distribution list group how to bulk change primary smtp address distribution list group (before @ / prefix) with powershell? can use csv file? if possible, what is the csv format and how is the script? please help, thank you.SolvedIrvanROct 12, 2024Copper Contributor229Views0likes6CommentsAzure powershell Set-AzStorageLocalUser - how to use existing ssh key in azure?
I am trying to build powershell script to create a local user for sftp in the Azure Stroage account. We have ssh keys already created in Azure. When the local user is created, existing ssh key created in azure should be assigned to the user. This can be easily done through Azure portal. However, we are looking for the same option in the powershell commandlet. Set-AzStorageLocalUser has option for "sshAuthorizedKey", but there is no option to select existing key. Do we know how this can be achieved?Solved273Views0likes4CommentsGet-NetIPAddress does not respect $ErrorActionPreference = "Stop"
I have a script that is set with `$ErrorActionPreference = "Stop"`and `Get-NetIPAddress` fails, but the script continues to run for some reason. Passing `-Error Stop` to `Get-NetIPAddress` will fix that, but I would expect to stop without it as well. I read both about ErrorActionPreference and Get-NetIPAdress and didn't see any mention of this behavior. Here is a short repro - link I was wondering if someone can help me understand why this happens, and whether there are any more magical cmdlets that are behaving the same. Thanks. For context, I'm using powershell version 5.1.SolvednoamlernerSep 30, 2024Copper Contributor252Views0likes2Comments
Resources
Tags
- Windows PowerShell1,126 Topics
- powershell335 Topics
- office 365268 Topics
- Azure Active Directory135 Topics
- Windows Server126 Topics
- SharePoint125 Topics
- windows96 Topics
- azure91 Topics
- exchange85 Topics
- Community54 Topics