Forum Widgets
Latest Discussions
Export/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 domainStefanoC66Nov 29, 2024Brass Contributor28Views0likes1CommentMicrosoft 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?zacNov 29, 2024Copper Contributor14Views0likes0CommentsHow does Defender work with other AV
Another thing I ran across that would like some explanation. Tested on both Win10/11. With both Avast and Defender checking AV with powershell Product GUID : {D68DDC3A-831F-4fae-9E44-DA132C1ACF46} Name : Windows Defender Real-time Protection Status : Enabled Computername : [ME] Product Executable : windowsdefender:// Reporting Exe : %ProgramFiles%\Windows Defender\MsMpeng.exe Definition Status : Up to date Product GUID : {EB19B86E-3998-C706-90EF-92B41EB091AF} Name : Avast Antivirus Real-time Protection Status : Enabled Computername : [ME] Product Executable : C:\Program Files\Avast Software\Avast\wsc_proxy.exe Reporting Exe : C:\Program Files\Avast Software\Avast\wsc_proxy.exe Definition Status : Up to date and if Defender is set up to scan on occasion shows up as enabled #when running # Get-MpComputerStatus AMEngineVersion : 1.1.24090.11 AMProductVersion : 4.18.24090.11 AMRunningMode : SxS Passive Mode AMServiceEnabled : True AMServiceVersion : 4.18.24090.11 AntispywareEnabled : True AntispywareSignatureAge : 21 AntispywareSignatureLastUpdated : 11/6/2024 5:05:45 AM AntispywareSignatureVersion : 1.421.135.0 AntivirusEnabled : True ...... more properties follow but not relevant here but when I try to update, get error #Update-MpSignature Update-MpSignature : Virus and spyware definitions update was completed with errors. At C:\PSFiles\AV\Defender.ps1:3 char:1 + Update-MpSignature + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (MSFT_MpSignature:ROOT\Microsoft\...SFT_MpSignature) [Update-MpSignature], CimException + FullyQualifiedErrorId : HRESULT 0x80070652,Update-MpSignature Is this an issue with Cim vs WMI?StanLNov 27, 2024Copper Contributor9Views0likes0Commentspowershell on mac
Hello Everyone, I’m new to using PowerShell on a Mac. I was given a PS1 script that needs to be run on a Mac device to check the files and folders of logged-in users. I managed to achieve this to some extent, but now I’m stuck on granting full disk access to the PWSH app via a Jamf Pro privacy payload. Since the PWSH app is not a signed package, I was unable to identify the “code requirements” to add a payload in Jamf Pro. Could you please share your best practices for deploying PowerShell and granting it full disk access via Jamf Pro?Shamir_MohammedNov 26, 2024Copper Contributor26Views0likes0CommentsAssistance Needed with OneDrive and Office 365 Activity PowerShell Scripts
Dear All, I am using the scripts below to retrieve OneDrive and Office 365 activity details for my tenant. However, in the "User Principal Name" field, I am getting an ID instead of the email address. This issue started after September 18; prior to that, it was working fine and showing the email addresses as expected. I run these scripts daily and generate a Power BI report based on the output. Scripts Used Get User OneDrive Activity: Invoke-GraphApiRequest -uri "https://graph.microsoft.com/v1.0/reports/getOneDriveActivityUserDetail(date=$yesterdaydate)" -FileName "OneDrive\ODUserDailyActivity\OneDriveUserDailyActivity" -Verbose:$VerbosePreference Invoke-GraphApiRequest -uri "https://graph.microsoft.com/v1.0/reports/getOneDriveUsageAccountDetail(date=$yesterdaydate)" -FileName "OneDrive\ODUsageDailyReport\OneDriveUsageDailyReport" -Verbose:$VerbosePreference Here is an example of the output I’m receiving: Report Refresh Date,User Principal Name,Is Deleted,Deleted Date,Last Activity Date,Viewed Or Edited File Count,Synced File Count,Shared Internally File Count,Shared Externally File Count,Assigned Products,Report Period 2024-11-22,830E1CDE8B16F21C80B207D213852737,False,,2024-11-22,1,0,0,0,MICROSOFT COPILOT STUDIO VIRAL TRIAL+MICROSOFT 365 E5+MICROSOFT COPILOT STUDIO USER LICENSE+MICROSOFT POWER AUTOMATE FREE+MICROSOFT INTUNE SUITE+MICROSOFT FABRIC (FREE)+MICROSOFT DEFENDER VULNERABILITY MANAGEMENT ADD-ON+DYNAMICS 365 CUSTOMER VOICE TRIAL+PLANNER AND PROJECT PLAN 3+POWER APPS PREMIUM+MICROSOFT POWER APPS FOR DEVELOPER,1 This is just one example, but I am seeing similar results for most of these scripts. Could you please help me resolve this issue? Thank you in advance!347Views0likes0CommentsNot able to export AD attribute departmentnumber
Hi, I'm trying to generate a report for all AD users with some AD attributes, such as SamAcconutName, department, departmentnumber, etc. The report is fine with all except departmentnumber. it shows "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" instead of actual number. Here is my PS cmdlet. get-aduser -Properties * | select displayname, departmentnumber | Export-Csv c:\temp\users.csv -NoTypeInformation When tested against a single AD account using the same cmdlet, the screen output shows the value with { }, for example, {123456} instead of 123456. employeenumber attribute worked fine. The same cmdlet shows just the number. Please help, How can I query and export attribute departmentnumber in a report properly? Thanks, Davedding0919Nov 21, 2024Copper Contributor57Views0likes4CommentsPowershell 7 getting error updating multi-valued attribute using Set-ADUser. PS 5.1 works
Hi there, I recently moved to PS 7.4 since there is some additional commands related to parallel threads. Now I'm facing an unexpected error due to multivalued updates using Arrays. It says "Invalid type 'System.Collections.ArrayList'" using the following command (that works in previous PS versions): Set-ADUser -identity "user" -Replace @{uid=@("value1","value2")} Already tried many options, like using variable, explicit array declaration and followed Copilot suggestions, but no success yet. It seems like a bug for me. Does anybody knows how to overcome this issue?mmussoliniNov 19, 2024Copper Contributor44Views0likes3CommentsDoes Microsoft stop support WMIC or WMI?
Hello everyone, Nice to meet you! I heard that MS has plans to deprecate and stop supporting the VB script very soon. I have few queries, please clarify Does Microsoft stop supporting WMIC or WMI along with the VB script? Can we use WMI commands in PowerShell scripts? thanks MadhumadhugeddadaNov 16, 2024Copper Contributor43Views0likes1CommentHash/Array return values
I ran across a difference in return values for built in properties depending on whether collecting with a hash or an array. The code below selects an Excel document and iterates properties. If the $hash variable is set to $false the properties are collected as an array, otherwise as a hash. Script run in ISE for Powershell 5.1. A hash comes up with properties not included if array used. This is not a problem to be solved, per se, but is there an explanation for the difference. $hash = $true #change to $false for array $pop = New-Object -ComObject wscript.shell $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ InitialDirectory = $PSScriptRoot Filter = 'Excel Files (*.xlsx;*.xls)|*.xlsx;*.xls' Title = 'Select Excel File' } $result = $FileBrowser.ShowDialog() If ($result -eq 'Cancel') { $popup = $pop.popup("No File Selected",2,"Closing",4096) exit } $xl = $FileBrowser.FileName $popup = $pop.popup("Iterating Built In Properties for $xl `n Please Wait",4,"Running",4096) $excel = New-Object -ComObject Excel.Application $excel.Visible = $false $workbook = $excel.Workbooks.Open($xl) $binding = "System.Reflection.BindingFlags" -as [type] if ($hash -eq $true) {$props = @{} } else {$props = @() } Foreach($property in $workbook.BuiltInDocumentProperties) { $pn = [System.__ComObject].invokemember("name",$binding::GetProperty,$null,$property,$null) trap [system.exception] { if ($hash -eq $true) { $props.Add($pn,"Value Not Found")} else {$props += "$pn`: Value Not Found"} continue } if ($hash -eq $true) { $props.Add($pn,[System.__ComObject].invokemember("value",$binding::GetProperty,$null,$property,$null)) } else {$props += "$pn`:" + [System.__ComObject].invokemember("value",$binding::GetProperty,$null,$property,$null) } } $excel.quit() $excel = $null $props | FT [gc]::collect() [gc]::WaitForPendingFinalizers() ExitStanLNov 10, 2024Copper Contributor28Views0likes0Comments
Resources
Tags
- Windows PowerShell1,122 Topics
- powershell335 Topics
- office 365267 Topics
- Azure Active Directory135 Topics
- Windows Server126 Topics
- SharePoint124 Topics
- windows96 Topics
- azure91 Topics
- exchange84 Topics
- Community54 Topics