logo
down
shadow

POWERSHELL QUESTIONS

Powershell to EXE tool Advice
Powershell to EXE tool Advice
To fix this issue When I had a similar deployment problem - 1) user's didn't know powershell 2) I didn't want them to have to understand things like execution policy, 3) how to start PS, 4) etc. I wrapped it in a batch file. I also wanted to make sur
TAG : powershell
Date : November 25 2020, 09:00 AM , By : ykamm
Powershell run script with Import-Module
Powershell run script with Import-Module
To fix the issue you can do I have created a module for my admin group with some functions that automate some procedures we commonly perform (add administrators to remote machines, C drive cleanup, etc...) , Any code that's not a function will run wh
TAG : powershell
Date : November 24 2020, 09:00 AM , By : David Chen
Change color on return data
Change color on return data
it helps some times Sure, that's easy enough. Just wrap the command up in a sub-expression and use Write-Host just like you do with the offline servers.
TAG : powershell
Date : November 23 2020, 09:01 AM , By : SobitMaan
Unable to get msbuild and powershell to play nice with parsing a path that contains spaces
Unable to get msbuild and powershell to play nice with parsing a path that contains spaces
I think the issue was by ths following , You have problem with quotes in your command. Simple solution would be to use single quote inside PowerShell command and put all command inside double quotes.
TAG : powershell
Date : November 22 2020, 02:42 PM , By : Robert rdbcci Boyce
batch/powershell to backup wlan profiles - need elevated rights (not admin!)
batch/powershell to backup wlan profiles - need elevated rights (not admin!)
like below fixes the issue my solution:i deploy a installation which installs a scheduled task (task runs as SYSTEM), it runs daily a powershell script if a new user has logged on, for every user (with exclude-list for special admin accounts) a users
TAG : powershell
Date : November 22 2020, 09:00 AM , By : Thomas Cleary
Powershell to get all TFS Workspaces
Powershell to get all TFS Workspaces
Hope this helps Try to use [System.Management.Automation.Language.NullString]::Value instead of $null for the first parameter.
TAG : powershell
Date : November 21 2020, 07:38 AM , By : Kunjii
Store string variable in text file
Store string variable in text file
Does that help You're using the wrong operator for comparing the $message value. See Get-Help about_comparison_operators.By saying if ( -not ($message= "")), you actually set the value of $message to be an empty string.
TAG : powershell
Date : November 19 2020, 03:54 PM , By : AFraser
Batch file doesn't read flags correctly
Batch file doesn't read flags correctly
help you fix your problem This is because the – marks are not - characters. They are actually endashes. These usually are caused by Word's automatic en/emdashing.Powershell is smart enough to convert the endashes to dashes as "arguments", but cmd is
TAG : powershell
Date : November 16 2020, 09:01 AM , By : Jahnvi
Using Generic.List with custom type as a return type for function is not working
Using Generic.List with custom type as a return type for function is not working
this one helps. Your error "Unable to find type [CustomType]" indicates that there is an issue in the order in which types are loaded, or that you've missed loading a dependency (be it a script or an assembly) completely.Check that before your functi
TAG : powershell
Date : November 12 2020, 09:01 AM , By : jatin
Is there an Azure command line interface for these AWS CLI functions
Is there an Azure command line interface for these AWS CLI functions
like below fixes the issue You can use the azure powershell or the azure xclion the azure xcli these commands are
TAG : powershell
Date : November 12 2020, 09:01 AM , By : Lovely Rizwan
Issue in removing user to a mailbox Exchange Server 2010 (set-mailbox remove)
Issue in removing user to a mailbox Exchange Server 2010 (set-mailbox remove)
I hope this helps . The error that you have listed isn't really an error, it's more of a warning. It's not telling you that it can't do something, it's just saying the parameters you provided don't exist.I recently wrote a script that had the same is
TAG : powershell
Date : November 10 2020, 09:01 AM , By : Roberto Tubaldi
Getting an error code 1 on Set-Acl on a network drive
Getting an error code 1 on Set-Acl on a network drive
hop of those help? There doesn't seem to be any quick answer for this. For some reason it's not possible to use Set-Acl on a synology nas.Anywhere you look you're referred to the tool 'synoacltool'. Absurd!
TAG : powershell
Date : November 09 2020, 08:00 AM , By : Aseem Sharma
How can I create a new Powerpoint presentation with Powershell
How can I create a new Powerpoint presentation with Powershell
it fixes the issue I found referencing this code in the below link helpful.https://gist.github.com/miriyagi/4240819
TAG : powershell
Date : November 08 2020, 09:00 AM , By : soulivanh bee
Running an exe in recursive folders
Running an exe in recursive folders
may help you . $start_path> Get-ChildItem-Recurse would write the string D:\VST\ to the file Get-ChildItem-Recurse in the current directory. Also, you need the call operator () for executing command strings, and you should include the extension if yo
TAG : powershell
Date : November 07 2020, 01:43 PM , By : Jerry Lu
Why does PowerShell chops message on stderr?
Why does PowerShell chops message on stderr?
it helps some times Solution The complete output on stderr of the executable is simply split across several objects of type System.Management.Automation.ErrorRecord. The actual splitting seems to be non deterministic (*). Moreover, the partial string
TAG : powershell
Date : November 06 2020, 03:59 AM , By : shamal banik
Splatting with Move-Item gives an error
Splatting with Move-Item gives an error
I wish did fix the issue. Ok, so the script itself is over 500 lines long, so I'll refrain from posting the entire thing. However, I have narrowed down the issue to a single line. , Change your Include from:
TAG : powershell
Date : November 05 2020, 06:58 PM , By : Emmanuel Ayodeji
I need to modify my WinSCP script to only download files of specific file extensions
I need to modify my WinSCP script to only download files of specific file extensions
it helps some times Your code is almost correct. Just just need to: -and the extension condition with "not directory" condition. Or use two separate Where-Object clauses as I do below. The GetExtension result includes the dot.
TAG : powershell
Date : November 05 2020, 06:58 PM , By : nvl
rename files script - how to use current directory for context menu
rename files script - how to use current directory for context menu
To fix the issue you can do You do not specify if the PS script is in the same location as the batch file, so I'm not going to assume that it is and treat this like the path to the script is hard coded into the batch file, and that the batch file cou
TAG : powershell
Date : November 04 2020, 04:00 PM , By : Pablo Andres Parrado
Purge a public MSMQ queue in Powershell 2.0
Purge a public MSMQ queue in Powershell 2.0
I think the issue was by ths following , Got it, I had to remove private$ instead of changing it.So this does the job :
TAG : powershell
Date : November 04 2020, 09:01 AM , By : Hasmukh Makwana
How do i run 7zip through powershell to extract a .rar folder?
How do i run 7zip through powershell to extract a .rar folder?
wish help you to fix your issue i have googled this already but i simply cannot find a straightforward right answer. i want to add a way to extract a .rar folder whether it be via winRAR or 7zip into my powershell script so i can automate it. I know
TAG : powershell
Date : November 04 2020, 08:15 AM , By : M Ansyori
looping through a csv with powershell
looping through a csv with powershell
With these it helps Im trying to loop through a csv file using powershell but for some reason my foreach loop will not execute. I looked online couldnt find anything about why this would be. Strangely if i use a simple for loop i can iterate, however
TAG : powershell
Date : November 03 2020, 09:01 AM , By : Rich
How to execute executable which added to PATH from powershell?
How to execute executable which added to PATH from powershell?
To fix this issue If you would like to add an environment variable for that session, in this case update PATH, you can use System.Environment's SetEnvironmentVariable method.Say, I want to run 7zip, but the path to its executable is not in my path. S
TAG : powershell
Date : November 03 2020, 09:01 AM , By : user4565639
powershell $lastexitcode does not work when running batch files
powershell $lastexitcode does not work when running batch files
around this issue echo %ERRORLEVEL% just writes the error code to stdout, after which the batch file exits normally.If you want the batch script to actually return an error on exit, use exit /b [exitcode]:
TAG : powershell
Date : November 01 2020, 04:09 PM , By : Danilo Iannetta
manage azure resource manager storage powershell
manage azure resource manager storage powershell
it should still fix some issue you can use the following new PowerShell commands to manage ARM (Azure Resource Manager) based storage accounts.Note: You need to update your Azure PowerShell later versions which support this new feature such as the No
TAG : powershell
Date : November 01 2020, 04:09 PM , By : S.S.Ratnesh
Union and Intersection of Hashtables in PowerShell
Union and Intersection of Hashtables in PowerShell
it helps some times You can use the same technique as for lists, but use the hash table keys, as you indicate in the OP. For union and intersection you have an additional problem. Of the keys in common between the two hash tables, which value will yo
TAG : powershell
Date : November 01 2020, 01:05 PM , By : Paul
Troubleshoot Powershell script inside Chef recipe
Troubleshoot Powershell script inside Chef recipe
hop of those help? I'm 95% sure you're actually hitting an error while trying to run the script and not handling it correctly. I know because this exact error just happened to me, a silent failure and for me it was because of the double quotes. Two W
TAG : powershell
Date : October 31 2020, 05:41 PM , By : Nnakwe Michael
Powershell pipeline with where not behaving as expected
Powershell pipeline with where not behaving as expected
hope this fix your issue It's a bug..... Read below. I have been testing with PowerShell 4.0 and see the same issue are you. I can make the problem go away if I do not allow the parameters to be bound by the pipeline.
TAG : powershell
Date : October 31 2020, 01:47 PM , By : rjb
Replace Single Quotes (') in Filenames
Replace Single Quotes (') in Filenames
it helps some times A Batch file also works fine to remove both and ' characters from filenames:
TAG : powershell
Date : October 31 2020, 10:01 AM , By : Kavion Jefferson
Use Get-Date "time" in an "if" statement PowerShell
Use Get-Date "time" in an "if" statement PowerShell
this one helps. Don't think in terms of output strings before you actually need to.> won't work for comparisons, you need to use -lt (less than) and -gt (greater than)
TAG : powershell
Date : October 31 2020, 10:01 AM , By : Rohit Makhija
How to sort a Multi Dimensional Array in Powershell
How to sort a Multi Dimensional Array in Powershell
I wish did fix the issue. My recommendation would be to convert the array of arrays into a list of custom objects and sort that list by the Timestamp property:
TAG : powershell
Date : October 31 2020, 10:01 AM , By : deepski
Add Simple PowerShell command to Batch File
Add Simple PowerShell command to Batch File
I wish did fix the issue. I am trying to add a couple simple PowerShell commands to a batch file. My preference is to keep the batch file self-contained vs calling an external .ps1 file.
TAG : powershell
Date : October 30 2020, 10:01 AM , By : LFoscari
What do the $package and $project params contain in a NuGet install.ps1 script?
What do the $package and $project params contain in a NuGet install.ps1 script?
I wish this help you In NuGet 2: $project => EnvDTE.Project - which is the Visual Studio object model for a project. $package => NuGet.IPackage - the NuGet package.
TAG : powershell
Date : October 30 2020, 10:01 AM , By : jared717
Passing the current File Path through to Powershell "SendTo" Script
Passing the current File Path through to Powershell "SendTo" Script
should help you out You don't have to do anything special to get the Send To context menu to send the file path to the target - it happens automatically.Try the following:
TAG : powershell
Date : October 29 2020, 10:01 AM , By : will
Split a string to multiple strings in powershell
Split a string to multiple strings in powershell
it helps some times Just FYI, if you want to declare each as a variable you can say $a,$b,$c,$d = $Value -Split (";") and each of $a, $b, $c and $d will retain those values.
TAG : powershell
Date : October 29 2020, 04:55 AM , By : Ahrime
Adding a User to AD group after checking in Powershell
Adding a User to AD group after checking in Powershell
this will help To explain what Matt is getting at a little more, the issue is with this check:
TAG : powershell
Date : October 29 2020, 04:46 AM , By : Sethu Bharathi
Identify Empty Folders
Identify Empty Folders
may help you . This article on Technet provides the following Powershell code snippet to identify all empty folders:
TAG : powershell
Date : October 29 2020, 04:45 AM , By : Laila popy
Is there a way to set a default value for a named parameter across many function calls in PowerShell?
Is there a way to set a default value for a named parameter across many function calls in PowerShell?
help you fix your problem Is there a way to set a default value for a named parameter across many function calls in PowerShell? , Use $PSDefaultParameterValues (PowerShell 3.0 and later):
TAG : powershell
Date : October 27 2020, 04:13 PM , By : Michael
Can not load powershell module: networkloadbalancingclusters
Can not load powershell module: networkloadbalancingclusters
I wish did fix the issue. Did you install the administrator tools for NLB? Install-WindowsFeature RSAT-NLB
TAG : powershell
Date : October 25 2020, 07:20 PM , By : houas mehdi
Opening the output file automatically
Opening the output file automatically
wish helps you I have a script that creates a csv file which I then go open to get the information I am looking for. Is there a way to add to the script so that the file opens immediately as well as saves in the specified location? , Add this quick s
TAG : powershell
Date : October 24 2020, 01:32 PM , By : omar chohou
Direct output from ant to powershell instance instead of cmd.exe window
Direct output from ant to powershell instance instead of cmd.exe window
I wish did fix the issue. cmd /c did what I needed.Avoided it since this article mentioned "This method should no longer be used with V3" but I'm guessing in a different context (example given is speed of dir command).
TAG : powershell
Date : October 22 2020, 01:59 PM , By : Siva Kurapati
shadow
Privacy Policy - Terms - Contact Us © animezone.co