Reddit » PowerShell
1,692 FOLLOWERS
A subreddit for Powershell users. PowerShell is a cross-platform (Windows, Linux, and macOS) automation tool and configuration framework optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models.
Reddit » PowerShell
43m ago
Hi all,
I'm working on a project where I need PNP commands (Get-PnPUserProfileProperty) and SPOService commands (Set-SPOUser). Basically, I need to write files to OneDrive folders PNP needs PSv7 and SPO needs PSv5. I need to be able to set the site collection admin (temporarily) in order to write the file to the folder, but I don't find any way to do that with PNP commandlets. This is all going to be in an Azure automation, so I don't have a great way of calling another terminal.
Ideas?
submitted by /u/--RedDawg--
[visit reddit] [comments ..read more
Reddit » PowerShell
4h ago
I am using 7zip to create archives of ms database backups and then using 7zip to test the archives when complete in a powershell script.
It takes literal hours to zip a single 112gb .bak file and about as long to test the archive once it's created just using the basic 7zip commands via my powershell script.
Is there a way I just don't know about to speed up 7zip? There's only a single DB file over 20gb(the 112gb file mentioned above) and it takes 4-6 hours to zip them up and another 4-6 to test the archives which I feel should be able to be sped up in some way?
Any ideas/help would be greatly ..read more
Reddit » PowerShell
4h ago
Kind of a broad question, but hoping someone can help out. The only scripts I've ever written so far work by exporting a CMDLET into a .csv file and then importing via the next CMDLET and so on. They work, no doubt, but some of the larger scripts involve multiple imports and exports. What is the standard way to build scripts without having multiple imports and exports? I'll post a sample script down below.
#Creates popup to notify of next steps $wshell = New-Object -ComObject Wscript.shell $Output = $wshell. Popup("Please log into X account") #Conects to AzureAD to create guest user Connect ..read more
Reddit » PowerShell
4h ago
I have a powershell script that is made to work as a DNS utility that will allow me to create/delete/update DNS entries. It is not currently able to handle CNAME as i think it was made to handle A records based on the create section of it. I need it be able to do all 3 functions on different record types with their individual required inputs. One of the main problems im running into is it is not able to handle a hostname instead of IP4 when trying to run it. I need it done very promptly. Can reimburse you for your time if it works properly.
submitted by /u/bear176174
[visit reddit] [comments ..read more
Reddit » PowerShell
8h ago
I have applied a GPO on startup that runs the PowerShell script (.PS1). We have set all our Execution policies for server/workstations to be Restricted. My script is doing what is supposed to do, my question is how the Restricted execution policy lets the script run. And I havn't signed the script.
submitted by /u/dumb08
[visit reddit] [comments ..read more
Reddit » PowerShell
8h ago
submitted by /u/Lower_Assistance8536
[visit reddit] [comments ..read more
Reddit » PowerShell
8h ago
I'm trying to run some code when a user connects to a citrix server instead of that user's account calling a powershell script, as regular end users don't have the rights to do so. I think our server isn't necessarily blocking the execution of the script so much as the write-host operation that would force a PS window to open.
submitted by /u/frermanisawesome
[visit reddit] [comments ..read more
Reddit » PowerShell
8h ago
Hi I'm sure if anyone can help but I've got an error with this script and not quite sure on how to resolve it.
The error is
Cannot convert value "Period from 01 June 2020 to 31 May 2021.pdf"" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\ProgramData\CentraStage\Packages\aedc1b3c-7362-4a0a-8f3c-b81b6d2ac8da#\command.ps1:113 char:5
+ [void]$Table.rows.Add(($Content[0].Replace('"','"')),$Content[2], ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : Invalid ..read more
Reddit » PowerShell
8h ago
As part of my script I am importing a CSV file similar to the following format
ComputerName
OS
Date
S-TEST-VM
Windows
5/9/2024
I am running the following command to import in the CSV file to a variable
$Comps = Import-Csv $MyComputers
As part of my script I am doing a check to see how many objects are in the CSV using
$Comps.Count
When I run this when it has one object it shows up with no value, however if I have 2 or more objects it works. As a workaround I have found that I can use $Comps.ComputerName.Count and it will show properly. Is there a reason why one object will not ..read more