Quantcast
Channel: Windows PowerShell Forum
Browsing all 2562 articles
Browse latest View live

Shameless request: convert Groovy script to PowerShell

Hi all, I'm submitting a shameless appeal to anyone who can convert my Groovy script to PowerShell.  I need to launch a process from a script that calls java.exe with some arguments.  I have the script...

View Article


sorting of files, get-childitem

Hi, I'm trying to create a variable with a list of some .txt files in a folder, sorted alphabetically: $txtfiles = Get-ChildItem "$Path\*.*" -include *.txt -name | Sort name -desc The strange thing is...

View Article


Change File Attributes get-childitem And disable attributes of files

hello, I want a script to reset the Files Attributes to Normal instead of Archive for particular files in a Directory. Any help?

View Article

How to -replace text which contains > ?

Why next script doesn't work correctly? : $S = [String] $S = '00 05:57:14.763,115,<?query --FETCH API_CURSOR0000000001D5D546--?>,DMRWP,NULL,0,0,NULL,39,' Write-Host "## Before: $S" $S = $S...

View Article

Active Directory Passing a variable fails

Hi, I am running the following commands and getting the error below, this appears that either i'm passing the wrong information or im not declaring the variable correctly. Could someone inform me how...

View Article


Find users from a field attribute in CSV list and output results

Can anyone point me in the right direction for creating a script for the following; I have a excel spreadsheet sent each month with a list of leavers one of the columns is the payroll number which we...

View Article

Image may be NSFW.
Clik here to view.

PowerShell Weird .Count Behaviour!

Hello, I'm getting weired random results from PowerShell. Here is the code: $UserName = "Test.Test10" $MatchingUsers = Get-Recipient -ANR "$UserName" | Where-Object {($_.RecipientType -eq...

View Article

Need timer to clear logs in continuous script

Hi, i have a script and it checks servers in the farm for high cpu and mem usage, im planing on running it continuously 24/7. I have it send an email if anything flagged and then log that in a file, i...

View Article


Get a list all users except Adminsitrator and krbtgt

Hi, I'm using the following cmdlet to get a list of all users not logged on to Active Directory for 60 days. The only issue is that 'Administrator' and 'krbtgt' also get listed. get-qaduser -inactive...

View Article


Powershell: OnFocus validate identity

I am building a form that will automate my companies computer builds a little better (SCCM doesn't do everything) and in order to make it "fat finger proof" I want to validate that the user id that is...

View Article

Renaming a user account to be zzz_OldUserName

Hi, I'm trying to run the following Quest AD cmdlet to import a list of user accounts from a .csv file and rename those accounts to zzz_OldUserName: "import-csv C:\Scripts\Exports\$(get-date -f...

View Article

read-host question

I am using the read-host command to have a user input his password to automatically map several network drives using the following command as an example $password = Read-Host "Please enter your NT...

View Article

Nested JSON within PowerShell

I'm having the hardest time trying to parse a nested JSON string. Thanks in part to various posts, I've been able to create a completely bastardized solution: Add-Type -Assembly System.Web.Extensions...

View Article


Looping through an Array and storing Random Numbers

I've tried different ways of storing random numbers into an array but I keep producing an error.  PS doesn't like $a[$x].  Is there another way of looping through an array and dropping in numbers?...

View Article

GPO is not running poweshell using bat on Server WK3

Hi All I have a W2k3 Server and have a bat file that has the following in it. - "Powershell.exe .\Localadminsetup.ps1" In the same folder location I have a powershell script which is designed to...

View Article


WMI Win32_UserProfile Class

How does the Win32_UserProfile ChangeOwner method work? If I have a domain user log into a Windows 7 machine, and I want to point it to the old user profile, so that the user doesn't lose anything, can...

View Article

WinForms need timer with refresh

Hi all I have a code for citrix farm that calculates available licenses. That all works fine. I just want some sort of auto refresh incorporated, i tried using timer and do a button perform click type...

View Article


Can you pass a variable to a SQL Script with invoke-sqlcmd?

So this may be a stupid question but is it possible to pass Powershell variable to a SQL Script for instance $Datetime=Read-Host 'Enter Date' $Datetime=$Datetime.trim() $dbs=Invoke-Sqlcmd...

View Article

Cant pull more than 8000 groups from AD

am trying to pull all the groups from Active Directory, but am not able to pull more than 8000 groups. Is there any setting which restricts this? or what is the way to pull all those AD groups? Thanks...

View Article

Accessing the user names of the group from shared folder

Hi, The input for the powershell script is the shared folder path C:\Temp\Payroll and I could able to populate the groups of the directory as below with access rights. EE\Domain Admins(Full...

View Article
Browsing all 2562 articles
Browse latest View live