Quantcast
Channel: /r/powershell – How to Code .NET
Browsing all 8793 articles
Browse latest View live

.bat files to launch .ps1 script named differently from the bat file

So I am using this in my bat file… @ECHO OFF PowerShell.exe -Command "& '%~dpn0.ps1'" PAUSE This executes the ps1 script that lives in the same location but script and the bat file need to be...

View Article


Adding a new-ADUser to the ‘member of’ field in Active Directory

Has anyone done something like this before? I’m writing a script that automates our new user process and need to assign the user to various groups in the member of section of Active Directory. Been...

View Article


Issues with Privilege Elevation (Administrator) Script

I’m basically new to PowerShell, and I wanted a script to write a script to do something which happens to use a command which requires administrator privilege. With some research I found a rather old...

View Article

Converting to ImmutibleID

Hey Reddit. I am trying to convert some objectguids from a CSV into an ImmutibleID I am doing $getaduserlist = Import-csv “Location” $ADGuidUser = Foreach ($aduser in $getaduserlist) {get-aduser...

View Article

import-csv – how to treat numbers as type double instead of strings?

Simple csv: username,averagescore,favoritecolor foouser,21424.224245,blue baruser,24244.13100,red Ultimately I’m looking to round the data in the middle column. I haven’t figured out the right order...

View Article


WinForm Manager for Powershell scripts

I use Powershell at my job to automate fixes for back end data issues. As a result I ended up with a large number of scripts that get run multiple times a day. Rather than run them one at I time I...

View Article

Function parameter – accept username string or ADUser object?

I am writing scripts for managing active directory users. How can I make a single parameter that can take either a username as a string (and lookup the user in AD to get the ADUser object), or an...

View Article

Switching from PS2.0 -> PS3.0

Hey everyone thank you so much for your help on my previous posts here. As I’m working out my code I’m realizing that I need PS3.0, how will this effect .PS1’s that are currently runnning on my...

View Article


Pre-populate OneDrive credentials

Making a small script to force my users to sign into OneDrive. Have the script working, however, the issue I am having is that it is not populating the email address like it should. $LoggedOnUser =...

View Article


Copying user folders from one server to another, user variable quesiton.

I’m writting a small login script that I’m going to assign to some users via GPO>login PS script. I’m trying to copy the users documents folder from “serverusersuserdocuments” to the new server,...

View Article

How can I make a script exit cleanly?

My script uses some forms with an “OK” and a “Cancel” button. So far I’ve tried using something if the user hits Cancel, then “exit”. However, I feel like that doesn’t exit the script cleanly. Are...

View Article

Question – Fetch recent installed updates using Powershell before reboot

I am trying to fetch the recent installed updates using Get-Hotfix or wmic command using powershell. The problem is I only need the recent installed updates (say today) but I am not able to filter it...

View Article

Getting specific data from xml file.

Hi all. I’m writing an application to help some of my co workers, move computer objects in our Active Directory more effecient. Everything is working as intended, yet I have a issue I cant seem to...

View Article


Invoke-WebRequest doesn’t execute javascript on page

Hi r/PowerShell, When i execute a webpage with New-Object -com InternetExplorer.Application I get the page with all elements as I would open it with the browser. But the overhead is great and it is...

View Article

Enumerating DNS zones from Microsoft DNS on Server 2008

Does anyone know how to enumerate DNS from a Server 2008 Domain controller? We are in the process of planning a switch over to InfoBlox for our internal DNS. As part of that, I have written an...

View Article


How would I copy a file into a shortcut folder?

Right now I’m executing the command (as a .bat file) copy C:UsersdallasDesktopscrapingRFP_CSVSIowa3232325757509106-30-17.csv C:UsersdallasDesktopcsv_rfp.lnk (csv_rfp.lnk is the shortcut folder that I...

View Article

How does New-LocalUser affect the PasswordRequired property?

I’m using the new cmdlet New-Localuser to create a local user. It works, but it doesn’t set the PasswordRequired property correctly. It sets it to False. My command is: New-Localuser -Name...

View Article


How to build a PowerShell Active Directory Sync Tool

submitted by /u/Net-Runner [link] [comments] The post How to build a PowerShell Active Directory Sync Tool appeared first on How to Code .NET.

View Article

Need to verify powershell remoting is allowed on public facing servers. Best...

So have 50 plus servers sitting on a dmz with exposure to the internet. I would like to administrate them using powershell within an internal server. I have done tests with Network guru’s to enable...

View Article

How do I search for a file and return the directory path the file is in.

I need to copy some files to the same place another file exists on remote machines. So far I’ve been able to find the file and return the path with the script below but the path is an object not a...

View Article
Browsing all 8793 articles
Browse latest View live