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

ConvertTo-JSON an array with a single item

I'm trying to create a JSON-serialized array. When that array contains only one item I get a string, not an array of strings (in JSON).Multiple Items (works as expected):PS C:\> @("one", "two") |...

View Article


PowerShell Script to Change Printer Drivers on Several Printers

I'm trying to make a PowerShell script that will change all the drivers for a specific set of printers.I have about 200 printers whose name begins with the letter Z.I also have a handful of printers...

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

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

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


hexadecimal value 0x00, is an invalid character. Line 2, position 1

We are running a PowerShell command and in that PowerShell command we are calling the XML file and trying to install veeam software. I am getting an error likehexadecimal value 0x00, is an invalid...

View Article

"Access to the path is denied" when attempting to redirect output to a file

I'm trying to redirect console output from a TFS command to a file with the following command:witadmin listfields /collection:blahblah:8080/tfs/TPC > TFSfields.txtbut I get an error:"Access to the...

View Article

Compare two lists in Powershell

I have just started working on powershell. I have two lists of 132 and 134 records each. They have 85 records in common and I want to get the values which are in list1 but not in list2 in a seperate...

View Article


PowerShell Multiple DynamicParam

I'm attempting to create a function for a script module that verifies the previous parameter has been set before it shows the next parameter.The parameters I need are Identity, Share and Quota. I...

View Article


Check if files exist using Powershell

I have a Powershell script which I've cobbled together. It uses an external file as a lookup then checks the LastWriteTime of those files.This was created as a checking procedure. To ensure a set of...

View Article

Image may be NSFW.
Clik here to view.

How can I obtain the driver key for an installed device?

Unfortunately this Question was asked 4 years ago but no answer yet How can I obtain the driver key for a driver programmatically?actually if it was answered, I would not ask again.I have a software...

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

Get-Aduser -Filter will not accept a variable

I'd like to check if a user account already exists in the system.$SamAc = Read-Host 'What is your username?'$User = Get-ADUser -Filter {sAMAccountName -eq "$SamAc"}I'm not sure why, but $User will...

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

How to import custom PowerShell module into the remote session?

I'm developing a custom PowerShell module, which I'd like to use in context of a remote session to a different computer. The following code (which obviously doesn't work) explains what I'm trying to...

View Article


How to get Powershell Invoke-Restmethod to return body of http 500 code response

Invoke-RestMethod call returns only very unhelpful exception below and does not (as far as I can tell) allow you to collect the body content (JSON object shown in fiddler trace results). This seems a...

View Article

Launch Elevated CMD.exe from Powershell

I am trying to launch an elevated CMD window from PowerShell but I am running into some issues. Below is the Code I have now. There is an admin account on the machine that has the username of "test"...

View Article


Get full stack trace from remote session

I'm using Invoke-Expression under remote session and when throws exception - it returns just RemoteException without any stack trace information. Example:try{ Invoke-Expression "$command 2>&1"}...

View Article

Get DL Groups user is member of in Exchange online

I'm trying to get the list of DL groups user is member of in O365. I'm using below PS Script but I'm getting the error message.$user = "test1@rtest.com"$dlGroups =Get-DistributionGroup |...

View Article

How do I write a value to an OPC tag in kepware using PowerShell

How do I write/update the value of tag2 in Kepware using PowerShell. This is my code example and I am getting the errorInvoke-RestMethod : The remote server returned an error: (400) Bad Request.At...

View Article

Is there a way to check if the script is running by PowerShell ISE?

I want to skip the Start-Transcript and Stop-Transcript lines if the PowerShell script is running by PowerShell ISE.Is this possible? And how can I achieve this?

View Article


Image may be NSFW.
Clik here to view.

API returning response as 3 instead of json when we copy request from "copy...

when i tried to copy request objects from chrome browser by "Copy as PowerShell" option , and try to paste that into PowerShell in my machine.i am getting content in response as 3 ,instead of json...

View Article


Enter-Pssession not working

I have to machines in same network one with windows7 and another win windows server 2012.I tried Enter-PSsession on windows7 machine from server2012 machine... $ComputerName = "windows7-PC"...

View Article

Replace-Files Powershell

I'm having some struggles with my PowerShell script. I am trying to make an Automated Script that will Perform the Utilman.exe Hack. The script has menus and options: Load, Unload, List Disk and Create...

View Article

How to remove property header from output when runnign Get-ADComputer

I want to pull the names of computer objects in AD in to a file. The method I'm trying so far is this$computers = Get-ADComputer -Filter * | Format-List namewrite($computers) | Out-File -FilePath...

View Article


How to properly export XML to file using Powershell

Importing any valid XML file as source using [XML]$Var = Get-Content -Path $PathToAnyValidXML I am unable to export it's content properly. Using Set-Content SomePath $Var , the file ends with...

View Article

Easier way to parse 'query user' in PowerShell (or quser)

I currently have the following query in PowerShell:query user /server:$serverWhich returns output:USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME svc_chthost 2 Disc 1:05 8/16/2016 12:01 PM...

View Article

Suppressing VERBOSE for Import-Module

I'm importing Carbon into my PowerShell script; however when running my script with -Verbose, Carbon also outputs a lot of VERBOSE statements.Is it possible to Import-Module silently such that I can...

View Article

exporting from powershell to txt file

I'm trying to set up a scope on dhcp via powershell and export info to txt file. My code does what it needs to do, but when i export to txtfile with | out file it only exports the reserved ip not the...

View Article



How to truly automate a powershell script without scheduler

My script basically runs on specific times during a day. Accesses the server and downloads data. So far I have tried playing around with start-sleep command and timespan command but I am new to...

View Article
Browsing latest articles
Browse All 132 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>