How can I split the results from the string?
I’m trying to seperate the key from the whole string. I tried .Split but for some reason trying to .Split[‘=’] doesn’t work. # Parameters param ( [string]$strComp ) #Clear the screen cls # Check...
View ArticleCmdlet parameters.
Hi. How do I set a parameter in a Cmdlet to be optional and like a switch where they put -e and it will run a certain command in the script, and if they don’t, it’ll skip it completely? So you might...
View ArticleScript to gather workstation IP, name and current logged in user
Where I currently work, DNS isn’t functioning adequately to provide support techs like myself with correct name to IP resolution. Not 100% sure of the nature of the issue, but much of the time, the IP...
View ArticleMaking better REST calls
submitted by /u/tottenham12712 [link] [comments] The post Making better REST calls appeared first on How to Code .NET.
View ArticleDSC Resource Kit November 2016 Release
submitted by /u/PowerShellChallenge [link] [comments] The post DSC Resource Kit November 2016 Release appeared first on How to Code .NET.
View ArticleIs it possible to add a registry value for another user with Powershell?
Right now, I’m using: New-ItemProperty -Path 'HKCU:SoftwareMicrosoftWindowsCurrentVersionInternet Settings' -Name "WarnonZoneCrossing" -Value "0" -PropertyType DWORD -Force It works, but I need to do...
View ArticleMove folders with dates to other dated folders
I have a series of folders like this: 2016-01 2016-02 2016-03 2015-01 2015-02 2015-03 I’d like to move them to folders for the year in the same folder and create those folders if they don’t exist:...
View ArticleWorking with custom objects
I’m having some issues getting data into a custom object correctly. I have raw data being input (via GUI form): Site: HR Employee Name: John Smih Employee ID: 12345 Employee Type: PERM Termed By: John...
View ArticleEmail on system start with reason
I currently have a PowerShell script that runs in the Startup folder on Windows 10. It just emails me that it came up. $EmailFrom = "email address" $EmailTo = "email address" $Subject = "Helios...
View ArticleNeed help creating a loop that counts up until computer rename is successful.
I have a script that renames the PC to $username or $username+LAP. If the computer name is already taken in AD, I’d like it to append a number at the end (i.e. “1”) and count up until the rename is...
View ArticleMultiline examples with comment-based help?
Anyone tried providing examples consisting of multiple commands through comment-based help? When I try to do this Powershell insists on treating the first line as the example, prepending a prompt and...
View ArticleSharepoint Site and Subsites + Privs
Howdy! So we use sharepoint for clients so they can submit work and “evidence” for us to use. So with our numerous amounts of clients we cycle through we need to create sites, subsites and user privs...
View ArticleRetrieving Directory Sizes and Removing Home Drives
A few days ago I was running into errors and inconsistencies when trying to work with directory size checking. I realized eventually that it was only a permissions issue. Feel free to use any portion...
View ArticleArchiving IIS logs.
Powershell noob here, hoping to gain some insight as to how to go about this. So I downloaded a script here: Link which did exactly as described. This script is ran on the server locally. What I’m...
View ArticleGet FolderPath from OpenFileDialog Call
Currently running a $OpenFileDialog block of code that has user’s select an EXE/MSI. I have been able to collect the full path via $OpenFileDialog.filename but I would like to save the FolderPath as...
View Article[Question] Function formats a Uuid for me, but I don’t understand how it works
Below is the function. It gets a Uuid for a virtual machine, which looks like this: 42125df4-e589-b449-2329-1c0b5e01cdc5 And parses it so that it ends up looking like this: VMware-42 12 5d f4 e5 89 b4...
View ArticleNeed to pull login script name and place in file path to run batch file
Working on a powershell script for our conference room laptops. The users will log in with a generic username and password and then run this powershell script that will ask for username and password...
View ArticleHow to close out open files from a share folder
i have a share drive that my users connect to. i need to be able to close out all users sessions for a specific file so that i can update it every morning. is there a way to do this for a remote...
View ArticleScript for VM Deployment in Windows 10
So I think i have most of this script correct, but want to add some ‘if’ statements to some parameters and eventually spit out a nice verbose log of the whole operation. Pretty sure the log part is...
View Article[OLEDB][Excel]Handling special characters for insert statement.
Hello r/Powershell , I didn’t think about looking for a PS subreddit while making this amalgamation but I’m a bit at a loss (likely burnt out since I’ve been slowly working on this all week as a side...
View Article