powershell
338 TopicsCopy-Item -Recurse bug
We are copying files using the Copy-Item cmdlet from a local disk to a remote disk. The source folder contains around 900 files in numerous subdirectories. Copy-Item -Path "build\image\*" -Destination $output_path -Recurse -Verbose Get-Command Copy-Item | Select-Object Name, Version Name Version ---- ------- Copy-Item 3.1.0.049Views0likes0CommentsFC Target discovery
I was looking for a way to discover FC targets for each initiator. Searching on the web I found this code # Get all initiator ports (HBA ports) $initiatorPorts = Get-InitiatorPort # Loop through each initiator port and list its targets foreach ($port in $initiatorPorts) { Write-Host "Initiator Port: $($port.NodeAddress) - $($port.PortAddress)" $targets = Get-InitiatorTarget -InitiatorPortAddress $port.PortAddress foreach ($target in $targets) { Write-Host " Target: $($target.NodeAddress) - $($target.PortAddress)" } } But is not working because the Get-initiatortarget is not recognized as valid command. Is there a way I can do it thanks15Views0likes0CommentsActivating a users multiple PIM groups using PowerShell
Hi All, Following on from the implementation of PIM by one of my clients. Due to the large numbers of groups for some staff, i.e. developers etc, we have looked into activating them programmatically. However, this always appears to fall over due to the syntax etc. Whether using Get-MgPrivilegedAccessGroupEligibilityScheduleInstance or Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/beta/identityGovernance/privilegedAccess/group/assignments" or New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest. In various scripts, it either falls over intermittently saying '..is not recognised as the name of a cmdlet..etc etc etc. To check whether anyone else has achieved this. I am trying to avoid reworking what they have put in place over the past 3 months or so. Many Thanks MoZZaSolved54Views0likes1CommentSet historic calendar entries for a specific user to private
Hi all. To improve engagement and to make organising meetings easier, I'd like to automatically set everyone's calendar so that everyone else in the organisation can see the title & location of appointments / meetings. For this I'm going to use the following Exchange Online PowerShell script: Get-Mailbox | ForEach-Object {Set-MailboxFolderPermission $_”:\calendar” -User Default -AccessRights LimitedDetails} However, before I do this, I'd like to offer individuals who have a lot of sensitive meetings (e.g. HR, Finance, Exec's) the option to set all their historic calendar entries to Private (so only invitees would be able to see any details). Is it possible to do this with PowerShell please? It's easy to set their whole calendar to Private, but I'd just like to set historic calendar entries with this tag. Hope you can help, and thank you.1.7KViews1like2CommentsExport/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 domainSolved108Views0likes1CommentWindows Restricted User Experience Set-CimInstance Error
So I'm trying to set up a restricted user experience that allows the usage of only one application. However, I keep running into this weird error message that provides no useful information: I've been successful in getting the boilerplate example from the official Windows guide to work, so I'm fairly certain the error lies in how I've set up the Allowed Apps and PinnedList. Perhaps in the path to the app? But I'm not sure how I'd go about changing that since I got the pathway from the task manager. Any help is appreciated! Full code below: psexec.exe -i -s powershell.exe $assignedAccessConfiguration = @" <?xml version="1.0" encoding="utf-8"?> <AssignedAccessConfiguration xmlns="http://schemas.microsoft.com/AssignedAccess/2017/config" xmlns:rs5="http://schemas.microsoft.com/AssignedAccess/201810/config" xmlns:v3="http://schemas.microsoft.com/AssignedAccess/2020/config" xmlns:v5="http://schemas.microsoft.com/AssignedAccess/2022/config"> <Profiles> <Profile Id="{9A2A490F-10F6-4764-974A-43B19E722C24}"> <AllAppsList> <AllowedApps> <App AppUserModelId="Microsoft.RemoteDesktop_10.2.3012.0_x64__8wekyb3d8bbwe" /> </AllowedApps> </AllAppsList> <v5:StartPins><![CDATA[{ "pinnedList":[ {"packagedAppId":"Microsoft.RemoteDesktop_10.2.3012.0_x64__8wekyb3d8bbwe"}, ] }]]></v5:StartPins> <Taskbar ShowTaskbar="true" /> </Profile> </Profiles> <Configs> <Config> <AutoLogonAccount rs5:DisplayName="RDUSER" /> <DefaultProfile Id="{9A2A490F-10F6-4764-974A-43B19E722C24}" /> </Config> </Configs> </AssignedAccessConfiguration> "@ $namespaceName="root\cimv2\mdm\dmmap" $className="MDM_AssignedAccess" $obj = Get-CimInstance -Namespace $namespaceName -ClassName $className $obj.Configuration = [System.Net.WebUtility]::HtmlEncode($assignedAccessConfiguration) Set-CimInstance -CimInstance $obj371Views0likes2Commentsscript 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.Solved1.1KViews0likes5CommentsPowerShell script to reinstall Windows license key
Greetings, I am new to PowerShell. I was talking with my boss recently about an issue we had following the Windows 11 24H2 update. The Windows license is being deactivated following the update. My boss has written a PowerShell script to resolve this issue but he asked me to see if I can write a script as well to fix the issue. He thought it would be good practice for me to learn PowerShell. So he has tossed me into the deep end and I need to quickly learn to swim; ) I need a script that would reinstall the Windows license key, activate the key, and change the DEP policy to opt out mode. This task is above my skill level and I could use some help. Thanks in advance295Views0likes3CommentsI can add myself to any Site Owners group via the web but getting Access Denied using PowerShell
Add-SPOUser -Site "https://mysite" -Group "mySite Owners" -LoginName myemail Add-SPOUser : Attempted to perform an unauthorized operation. I can successfully add other users to sites I'm already Owner using the above CMD. Thank you!1.3KViews0likes5CommentsHow do I get HP Bloatware script to run during enrollment?
Hi all I am wanting to put a script within Intune so during the deployment phase of autopilot it would remove the HP Bloatware however if I attach this script https://gist.github.com/mark05e/a79221b4245962a477a49eb281d97388 into the deployment policy it would fail everytime. I can only remove it by going to the start menu , run powershell as admin and then run the script manually from there. What do I need to add so the script can run automatically? It wouldn't matter if it can't be run during the enrollment stage but I do want to somehow automatic this . Thanks736Views0likes2Comments