Stack Overflow » Powershell
by Subham
2h ago
I (administrator of the Windows) usually use Windows 11 Powershell v7 in Windows Terminal (as Administrator). So, I was using Git (I have not mastered it, I am still learning), & I created a new directory using the command mkdir index. Then I opened it using the command cd index. Then I used echo hello > file1.txt to add the simple text hello into the file. Then I used git add file1.txt to add the text file to the staging area. Then I used command git status to check the status of my repository. Then it showed I had untracked files. I used the git clean -fdx command to remove the untrac ..read more
Stack Overflow » Powershell
by SeyiA
2h ago
I was trying to update the pip packages on my windows computer using the following lines of code in my Anaconda Powershell Prompt: import pkg_resources from subprocess import call packages = [dist.project_name for dist in pkg_resources.working_set] call("pip install --upgrade --user " + ' '.join(packages), shell=True) This error popped up after a few of the packages had been updated: The error I get I have upgraded my pip, upgraded setuptools, and installed ez_setup, but the error keeps popping up.How can I fix this. Thanks ..read more
Stack Overflow » Powershell
by Zhar
2h ago
I've multiple files in a folder I want to check if A.txt.pgp.processed exists in current location. If it exists, Then I need to delete all A.txt.pgp files Where A is the name of the file without format. I need a batch file for the above task for multiple files. I tried below script: @echo off D: cd "D:\test" setlocal enabledelayedexpansion for %%f in (*.pgp) do ( set filename=%%f set processed=!filename:.pgp=.pgp.processed! if exist !processed! ( del %%f ..read more
Stack Overflow » Powershell
by Terry
2h ago
We need to place a new user in a "staging" group, and once they have set up some basic things, move them to a "production" group. Ideally we'd like to automate this based on the state of their system (after intune has had its way with them). Today we simply do this manually but, we have been thinking of using a Powershell script for this that is wrapped in a intunewin app and set the dependencies accordingly. Two questions: 1. IS it feasible to use powershell for this and 2. Is there a better, best practice way of doing this ..read more
Stack Overflow » Powershell
by dharmatech
5h ago
Here's a simple list of two objects: $ls = [PSCustomObject]@{ a = 10; b = 20; c = 30; }, [PSCustomObject]@{ a = 40; b = 50; c = 60; } Display the list using ft with calculated properties:$ls | ft ` @{ Label = ':a:'; Expression = { $_.a } }, @{ Label = ':b:'; Expression = {$_.b } }, @{ Label = ':c:'; Expression = { $_.c } } We get: :a: :b: :c: --- --- --- 10 20 30 40 50 60 Those calculated properties are a lot to type. So, it would be nice to have a function to create one for us. So, something like this: function create-format ($name) { @{ Label = (':{0 ..read more
Stack Overflow » Powershell
by Draw2Button
8h ago
I'm adapting a Powershell script I have that queries for and creates EXO contacts and users based on a list of names and email addresses from AzureAD to MS Graph. In my old script I could query for an email address with Get-EXORecipient and Get-AzureADUser. In the new world I'm using Get-MgUser and Get-MgContact. For the most part this has worked fine but I've now hit a wrinkle where I have multiple different contacts that have the same base email address using plus addressing to differentiate (so, user+a@foo.com, user+b@foo.com, user+c@foo.com, etc.). My old script handled this fine. But it a ..read more
Stack Overflow » Powershell
by FTBC
8h ago
The larger code generates a list of operating systems installed on machines we maintain. That list is stored as $WindowsList. Here's what I have so far to assemble the list of checkboxes. It works to build the form, but I'm realizing that I can't actually get all the data out this way. Foreach ($OS in $WindowsList) {$SelectOS = New-Object System.Windows.Forms.Checkbox $SelectOS.Location = New-Object System.Drawing.Size(30,$FormHeight) $SelectOS.Size = New-Object System.Drawing.Size(500,20)$SelectOS.Text = "$OS"$Form.Controls.Add($SelectOS) } How do I dynamically build ..read more Stack Overflow » Powershell by woytazeit 8h ago in short, this is the error: Error and this is the script: # Import-Module ActiveDirectory #$ADGroups = Import-Csv C:\temp\NewGroups.csv -Delimiter ";" #Create group in "Users" $OU = "CN=Users"$Path2 = "CN=Users,DC=master,DC=int" # Loop through each row containing group details in the CSV file foreach ($Group in$ADGroups) { #Read group data from each field in each row and assign the data to a variable as below $groupName =$Group.groupname $SAM =$Group.SAMName $gCategory =$Group.grouptype $gScope =$Group.groupscope $dispName =$Group.teamname $Path =$Gr ..read more
Stack Overflow » Powershell
by Groovy_dummy
9h ago
I have around 100 AD groups that I need to list out the Group Owners and reach out to them for specific tasks. I am trying to find out if there is a way in PowerShell to list out all my 100 AD groups and provide me an output with the AD group Owner's list. I was told that I can leverage: rundll32.exe dsquery,OpenQueryWindow . Honestly, I think there are better ways of setting this up and reaching out to folks here in the community. I am a rookie in Windows World. Any help or tips will be appreciated ..read more
Stack Overflow » Powershell
by techworm
10h ago
I have a strange issue in my Windows machine. I have a Python program that is working fine when run through local powershell or cmd. I can simply run it as below: & 'C:\Python317\python.exe' "path\to\api.py" (it stays there in powershell). or if I want to run the program in background, I can do: & 'C:\Python317\pythonw.exe' "path\to\api.py"an (it disappears from powershell, means i can close powershell now). Now I need to do the same with Azure DevOps Release Pipelines. I have tried many things but still the program isn't running as it does from local. I have added Powershell Job and ..read more

OR