Bulk drop and create Local Users in windows 2003 servers standalone
I have local standalone Windows 2003 which is not part of any Active Directory. I have a list of users (containing UserName & Password per line) in a CSV file and contain about 300+ user accounts....
View ArticleDoes anyone know if the Get-Random cmdlet uses...
I recently worked on a script where generating random passwords for accounts was a requirement. I found several examples of random password generator functions in PowerShell online, but every one I...
View ArticleTrapping if the CMD.ExE fails?
Hello!What I need to do is that I have a cmd.exe running a script and it either comes back as Pass or Fails. What I need to do is use a try catch block in my script so that when the cmd.exe fails, it...
View ArticleQuickly delete large folders with PS
I have a script right now that goes through and deletes a list of directories (old users home directories). It does this just fine and here is a code sample:Get-Content $UsersFile | ForEach-Object {...
View ArticleFind all files on a drive with user input using powershell
Hello,First I would like to state that I am not new to Powershell, but I am definetly a novice scripter trying to better his skills. I am currently trying to write a Powershell Script that A. Asks the...
View ArticleREGEX not matching
This is the string I am trying to match:"START /WAIT %MMMCPPROD%\cpfs -i ldtst -I HDM_ADT -P HDM_ADT -s"And this is my regex:^(?!rem)(?!\:\:)(?:START /WAIT )?[\w\%]*\\cpfs -i ldtst -I HDM_ADT -P...
View ArticleSet-Location : Cannot find drive. A drive with the name 'P' does not exist.
Hello All,I have a strange Problem with network drives I am mapping and using in Powershell. If I map a network drive the first time I could set-location and able to browse thought the drive. If I...
View Articleusing send-mailmessage to have resulted attachment html file placed in the...
Hi. Thanks for the time. I guess the title is a bit confusing. What I am trying to is 1) export a list to an htm file and then 2) email that htm into the body of the email. Can this be done using...
View ArticlePowershell - script to add user to security group if user does not already exist
Hi Everyone,I'm not too good when it comes to writing powershell scripts, but hopefully someone could be kind enough to either point me in the right direction, or (if you really feel like it) write the...
View ArticleCompare-Boject $._Sideindicator
I've got some simple script to compare the contents of a folder as follows:$folder1 = get-childitem $source | where-object {$_.lastwritetime –gt $DateToCompare} $folder2 = get-childitem $destination |...
View Articleexport disabled users that have mail attribute
hello. thanks for the time. i have another question. I had 2 tasks. 1 to get a list of all disabled users in the last 90days with no email attribute. i was able to achieve that. next is to get a...
View Articlebackup and restore a specific registry key in powershell
I am building a 2 scripts one to backup a large number of files and system settings and one to restore them after the system is re-imaged. I have everything set in the script but 1 thing I dont know...
View ArticleHelp for New-Mailcontact and Set-Contact
Hi,Objective for the script: I have been trying to write a script so I can create New-Mailcontact using CSV file, if not already exist in ActiveDirectory.If already exist in Active Directory then skip...
View ArticleExamples of using Powershell to import SharePoint Content Types from a CSV file
Hi, I am working on a script to import Content Types from a CSV document. Does anyone have a good working sample of being able to do this on the SharePoint 2013 platform?ThanksLeland Usher SharePoint...
View ArticleHow to grant permission to private key from powershell
I'm trying to find a way to grant permissions for private key from powershell script. Certificate is stored in CNG. All ideas are welcome.
View ArticleHelp to run a blinking text code in background
Hi All,I found a code on internet ,working code of a function to blink a text. I am using the function in my pwershell application . But I want the blinking code to run in background.The function is...
View Articlepowershell, replace an Array object with nothing
I need to get rid of an object ($deletehostname) in an array and have the following code:if ($BackConnectionHostnamesExists) { $zero="" $ExistingHostnames =...
View ArticleGroupPolicy - List GPO's where specific ADgroup dont have modify-permission
Hey,I want a list of GPO's where specific ADgroup dont have modify-permission. This is what I have so far:Function Get-AllGPPermissions { [CmdletBinding()] Param() Begin { # Set strict-mode...
View ArticleImport-Module Keep Prompting for Credentials!
Hello,I'm trying to establish "Implict Remoting" session and exported all of the imported cmdlets into a module. But when I first execute any command, it asking me to enter password when it's trying to...
View Articlehow to controll slow response times for negative? when using $tcpobject =...
hi,I am trying to quickly scan some servers to see what ports are open and have come across this:$tcpobject = new-Object system.Net.Sockets.TcpClientIt works fine but the time out for a NEGATIVE...
View Article