JMongi
Active member
- Local time
- Yesterday, 20:23
- Joined
- Jan 6, 2021
- Messages
- 802
Dipping my toe into the powershell arena. I know some basic programming (formal training in Pascal and QBasic) and what I've picked up of VBA from Excel and Access.
So, I can't say that I know any particular scripting language so I thought I would jump into powershell instead of learning something else. Anywho...
I'm trying to write a basic script to automate a directory structure and some other folders that we create for each major piece of equipment we fabricate. The basic steps could be broken down as:
1. Receive user input for Unit Number
2. Check if unit file already exists (cancel if true)
3. Create file structure.
4. Optional - Send e-mail to recipients informing them of directory creation.
Here's what I have so far (remember I'm very green to powershell)
I haven't been able to find a good reference for creating a shortcut. Can someone direct me to one? I have two additional folders (not yet shown) that should be created in separate server locations with shortcuts to those locations placed in the main directory structure.
So, I can't say that I know any particular scripting language so I thought I would jump into powershell instead of learning something else. Anywho...
I'm trying to write a basic script to automate a directory structure and some other folders that we create for each major piece of equipment we fabricate. The basic steps could be broken down as:
1. Receive user input for Unit Number
2. Check if unit file already exists (cancel if true)
3. Create file structure.
4. Optional - Send e-mail to recipients informing them of directory creation.
Here's what I have so far (remember I'm very green to powershell)
Code:
Add- Type -AssemblyName Microsoft.VisualBasic
$title = 'Unit Number as XX-XXXX'
$msg = 'Enter the unit number for the unit file.'
$UnitNum = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
$Path = "******"
New-Item -Path '$Path\$UnitNum' -ItemType Directory
New-Item -Path '$Path\$UnitNum\1 - CUSTOMER PROVIDED' -ItemType Directory
New-Item -PATH '$Path\$UnitNum\2 - ENGINEERING' -ItemType Directory
New-Item -PATH '$Path\$UnitNum\3 - PRODUCTION' -ItemType Directory
New-Item -PATH '$Path\$UnitNum\4 - PARTS' -ItemType Directory
New-Item -PATH '$Path\$UnitNum\5 - COMMUNICATION' -ItemType Directory
New-Item -PATH '$Path\$UnitNum\6 - PICTURES' -ItemType Directory
I haven't been able to find a good reference for creating a shortcut. Can someone direct me to one? I have two additional folders (not yet shown) that should be created in separate server locations with shortcuts to those locations placed in the main directory structure.