Recent Discussions
How to find out the type of a generic class?
Exmple: create a new List<string> instance: $a = [System.Collections.Generic.List[string]]::new() With: $a.GetType() I only get: IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True List`1 System.Object How can I tell what type the list is (in my case, string)?Solved30Views0likes2CommentsI want to change auto aftandend number using powershell
Hello, i want to create a powershell script where i can change the Auto attendant of the teams admin so that users can change the phone number of the after hours without having a teams admin license, does anyone know how i can change the number of the Auto attendants using powershell? Its in Auto attendants -> your Auto attendant -> Call flow for after hours -> Call routing options - > redirect call -> phone number that i want to change using powershell.Solved110Views0likes8CommentsPowershell error when using install-module
Hello ! when I use Install-Module -Name ExchangeOnlineManagement I get the following error : Install-Package: The module 'ExchangeOnlineManagement' cannot be installed or updated because the authenticode signature of the file 'ExchangeOnlineManagement.psd1' is not valid. I use powershell 7.5.0 Any help is welcome. best regardsSolved107Views0likes2CommentsGet a list of specific agegroup users stored on a security group
Dear Community, I wonder if it would be possible to get a list of users (stored in a security group) marked as "minor" and "not adult" using microsoft graph. Once I get the members of the group (using Get-MgGroupMember -GroupId XXXX), I am not sure how to retrieve only the ones with a specific agegroup property. Is that feasible? Any help would be greatly appreciated. Many thanks in advance!Solved47Views0likes2Commentsdownload data from web
Hi everyone I need to download a bunch of files from a website: https://www.finra.org/finra-data/browse-catalog/equity-short-interest/files The address doesn't show the filters that need to be applied. If you go to that website and select 'Any' for both Month and Year then you will see all the files. Can someone help me with creating the PowerShell script to download all the files to a local folder on my machine? Thank you cc: LainRobertsonSolved68Views0likes3CommentsRemote 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 ? thanksSolved93Views0likes1CommentExport/Import distribution group members
We're migrating from one forest to another and among other things we have to migrate memberships of distribution groups betweene the two. The problem arised because many distribution groups in the source forest contains "contacts" as members. Since we're using ADMT, which does not migrate contacts, to do the migrations we have exported/imported contacts to the target forest. Now when we migrate the distribution groups they lack the contacts in the membership so we thought of a way to read the distribution group membership from the source domain and update them in the target domain but couldn't manage to get the script working. How can we remotely run the script to extract the group memebership from source domain and add them in the corresponding groups in the target domainSolved77Views0likes1CommentMicrosoft Graph Sign in Log Script
Hi all, I'm trying to create a script that will check sign ins based on the location. How ever the location always appears as 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphSignInLocation'. I am able to see the location if I select the property 'location' by itself and expand the property, but then that only show's a list of the locations. If I add other properties, it either doesn't work or it displays like this: I tried exporting as a csv and the location column values showed up as 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphSignInLocation'. This is what I have currently: Get-MgAuditLogSignIn -Filter "location/countryOrRegion eq 'AU'" -Top 10 | format-list And if I try selecting properties (I would add more properties later, this is just an example: $properties = 'location, userprincipalname' Get-MgAuditLogSignIn -All -Filter "location/countryOrRegion eq 'AU'" -Top 10 -Property $properties | Select -ExpandProperty $properties Has anyone tried something similar?Solved132Views1like3CommentsNewbie 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???Solved52Views0likes3Commentsscript 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.Solved585Views0likes5CommentsRemove 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: LainRobertsonSolved175Views0likes8CommentsRemove 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 youSolved109Views0likes7CommentsHow 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 answerSolved245Views0likes4Commentschange 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.Solved274Views0likes6CommentsAzure 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?Solved300Views0likes4CommentsGet-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.Solved268Views0likes2CommentsChange file extensions
I have a folder with thousands of files all of which have different extensions. I need to change all the extensions to "jpg" and looked at Rename and replace, but since every extension is different I cannot provide all for the replace function. Sounds weird but the files were produced by a vendors application and all extensions are numeric, "001", "002", "003" and on. Any help would be appreciated.Solved861Views0likes2Comments[resolved] Variables are not consistent
Hello internet. My mind is completely blown by this! I have a PowerAutomate that sets some 'compose' actions and then uses them to start a job. It is a PowerShell 7.2 script running in a Runbook extension-based hybrid worker on a Debian 11 Azure VM. I've reduced the script to just printing the inputted variable values. That's all, yet it provides them transposed! param ( [string] $siteNAME, [string] $OMd, [string] $userNAME, [string] $templateNAME ) $scriptVERSION = "x.y.z" function WO { write-output $wriOU } write-output "----------------------------------" $wriOU = "siteNAME: "+$($siteNAME);WO $wriOU = "OMd: "+$($OMd);WO $wriOU = "userNAME: "+$($userNAME);WO $wriOU = "templateNAME: "+$($templateNAME);WO write-output "----------------------------------" $wriOU = "Script Version: [ "+$scriptVERSION+" ]";WO write-output "-end of line-" #EOF As you can see 'siteNAME' retains the value correctly. But then 'OMd', 'username', and 'templateNAME' goes sideways so hard... Why? What am I doing wrong, this seems super odd... Any insight is greaaaatly appreciated. TY!Solved364Views0likes2CommentsHow to combine 4 scripts into 1?
Hi I'm trying to use Intune to deploy microsoft apps icons onto the desktop At the moment I have 4 scripts for Outlook,Word,PowerPoint and OneNote $TargetFile = "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.exe" $DesktopPath = [Environment]::GetFolderPath("Desktop") $ShortcutFile = "$DesktopPath\Outlook.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Save() $TargetFile = "C:\Program Files\Microsoft Office\root\Office16\ONENOTE.exe" $DesktopPath = [Environment]::GetFolderPath("Desktop") $ShortcutFile = "$DesktopPath\OneNote.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Save() $TargetFile = "C:\Program Files\Microsoft Office\root\Office16\POWERPNT.exe" $DesktopPath = [Environment]::GetFolderPath("Desktop") $ShortcutFile = "$DesktopPath\POWERPNT.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Save() $TargetFile = "C:\Program Files\Microsoft Office\root\Office16\WINWORD.exe" $DesktopPath = [Environment]::GetFolderPath("Desktop") $ShortcutFile = "$DesktopPath\Word.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Save() How do I combine these 4 scripts into 1?Solved423Views0likes3Comments
Events
Recent Blogs
- One new resource, logging improvements and bugfixes. This is what SharePointDsc v5.2 is bringing to the table!May 12, 20227.5KViews1like0Comments
- 2 MIN READThis article describes a solution of an issue I have been troubleshooting today, where switching to an AllSigned execution policy resulted in the "This publisher is explicitly not trusted on your sys...Mar 18, 20226.4KViews1like1Comment