Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Browsing latest articles
Browse All 50 View Live

I am trying to get-adgroupmember from ad groups created in the last 30 days:

$groups = "TWA_NDL_ObsApp_WR_MAN", "TWA_NDL_ObsApp_WR", "TWA_NDL_ObsApp_WH_MAN"$users = Get-ADUser -Filter "(whenCreated -ge '$((Get-Date).AddDays(-30))')" -Properties whenCreated, memberOf |...

View Article



How to execute a CMD file in remote computer

I am looking to execute a command in remote machine using invoke but the .cmd file will call for additional .vbs script. So i guess i may have to mention CScript if so how do i mention both cmd/c and...

View Article

A PowerShell Script to install fonts on Windows 11

I would like help with the following ps script that I took from reddit to install fonts for all Windows 11 users, below is the original script:#set font source location$FontFolder = "FONT...

View Article

Fetch all the files in a folder but exclude all the files in a sub folder by...

I have a powershell script to fetch all the files in a folder but exclude all the files in a sub folder. I am using the following script, but not giving the expected results.Get-ChildItem -Path...

View Article

Configuring "Do not forcefully unload the users registry at user logoff" in...

I need to write a PowerShell script that should configure the below settings of Group policy in all the machines.Gpedit.msc → Computer Configuration → Administrative Templates → System → User Profiles...

View Article


Generating Powershell scripts by working in Windows GUI

My understanding is that virtually all "real work" done by the various GUI components in Windows Server 2012 (for example, in Disk Management) is performed by invoking Powershell. (That is, there's...

View Article

Writing a hex escaped char in Powershell

Is there any way to write something like this in Powershell? (Linux would be with Perl)char foo = '\x41';I need to input some non-printable characters to one of my programs

View Article

Getting the user's Documents folder in Powershell

I want to use a PowerShell script to automate tasks related to the user when the user logs in.Sometimes a user will have moved his Documents folder from the default location. How can I determine the...

View Article


Powershell - Why is Using Invoke-WebRequest Much Slower Than a Browser Download?

I use Powershell's Invoke-WebRequest method to download a file from Amazon S3 to my Windows EC2 instance.If I download the file using Chrome, I am able to download a 200 MB file in 5 seconds. The same...

View Article


get IPv4 address into a variable

Is there an easy way in PowerShell 3.0 on Windows 7 to get the local computer's IPv4 address into a variable?

View Article

Powershell Access to Path is Denied

I have developed a git pre-commit hook for my workplace. The way it operates is as follows:There is a pre-commit file that invokes a pre-commit.ps1 file in the same directory. Both are withing the...

View Article

Can't Activate Document in Pipeline (unix script)

I'm trying to run the program bayes-seg with: cat data/books/clinical/050.ref | ./segment config/dp.config using Powershell. I understand that the command cat outputs the file and pipe will use the...

View Article

PowerShell is missing the terminator: "

I have the following script code#[string]$password = $( Read-Host "Input password, please" )param ( [string]$ReleaseFile = $(throw "-ReleaseFile is required"), [string]$Destination = $(throw...

View Article


Launch Metro style apps using powershell

I am trying to write a powershell script for windows 10 that will automatically launch a Metro-style app.The Start-Process cmdlet seems like it should work, but I cannot get it to launch anything...

View Article

Copy-item Files in Folders and subfolders in the same directory structure of...

I am struggling really hard to get this below script worked to copy the files in folders and sub folders in the proper structure (As the source server).Lets say, there are folders mentioned below:Main...

View Article


PowerShell script to upload multiple tables into MySQL workbench DB

I tried using the below script to achieve the solution programmatically instead of manually using the MySQL workbench window to import from self-Contained File located under a folder in C:\ drive>#...

View Article

How to address mutable parameters like datatime in Powershell?

We have a server that is running out of space (435Gb remaining) and we want to know when it will as new 1Gb files are created every 15 hours consistently. So, I've crafted a script where users can...

View Article


Implement the subcommand pattern in PowerShell

Is it possible to implement the subcommand pattern in PowerShell? Something like:command [subcommand] [options] [files]Examples: Git, svn, HomebrewWhat would be the general architecture? A single...

View Article

Powershell command to select one value

My PowerShell command is working fine as below :PS C:\Users\username> whoami /userUSER INFORMATION----------------User Name SID================...

View Article

Image may be NSFW.
Clik here to view.

PowerShell script to export Array in CSV format with Headers

I've below PS Script which connects to API and puts responses on an Array List.I'm struggling to convert Array List to CSV file and giving them a Column Header.Anyone got Idea how to this can be done...

View Article

Powershell Try/Catch Exception to SQL

Hello I have a little problem regarding my error logging to SQL from powershell scripts.function Invoke-Sqlcmd { param( [Parameter(Position=0, Mandatory=$true ,ValueFromPipeline = $false)]...

View Article


PowerShell Add-WindowsFeature unrecognized

Thanks first of all for reviewing this.I've basically got a third-party agent software which allows me to execute PowerShell as LocalSystem. This allows me to easily run remote PowerShell commands...

View Article


How to catch sql query error in powershell

I have a query like this in my PowerShell Scripttry{ $Query = "SELECT ID / 0 FROM Tables1" Invoke-Sqlcmd -Query $Query -ServerInstance $Global:Server -Database $Global:Database}catch {"error when...

View Article

Managing "Cannot bind argument to parameter 'Path' because it is null

I have a powershell script that will move files containing certain "key words" to the corresponding folder listed in various .csv files. While I seem to have the mechanism down to move the files. I...

View Article

Looking for a list of service accounts that have read or write ability in...

I am looking for a list of service accounts that have read or write ability in AD.If all of the service accounts have that ability, then I might be looking for service accounts that query active...

View Article


PowerShell catch exception in Param() block

Param( [ValidateRange(21,90)] [int[]]$Age)How to catch exception when $age is out of range?

View Article

Image may be NSFW.
Clik here to view.

EXE silent installation

I have following PowerShell script to install application without user intervention:Start-Process -FilePath "C:\Temp\UpgradeClientInstaller\setup.exe" -ArgumentList "/S /v/qn"by giving /s in argument...

View Article

Invoke-Command with -credentials

I want to invoke a command on a remote server, I do not want to have to put in the password to run the script. I've tried encrypting the password and storing it in a txt file. $username =...

View Article

My PowerShell script only works when running from ISE

I can't post all of the script contenet, but the basic idea is that it downloads JSON and converts it to objects using the ConvertFrom-Json cmdlet. Some objects are filtered out, and the rest are...

View Article



PowerShell - Check if Java Application is running, if not - restart it....

I've had a good search around, but can't quite find what I'm looking for. We have Java applications running 24/7 on several remote machines which intermittently crashes (We think the application's devs...

View Article
Browsing latest articles
Browse All 50 View Live




Latest Images