使用方法:
1.下載檔案下載
2.解壓縮,解壓密碼demo1234
3.修改設定檔config.txt
4.對資料夾內的GoogleUserAdd.exe 點兩下
5.會產生xxxx_GoogleUserAdd.csv
6.將此csv匯入google大量新增帳號,完成。
以下是程式碼說明:
設定檔config.txt如下:
檔名:GoogleUserAdd.cpp
內容:
#include <iostream>
#include <fstream>
#define MAX_FILENAME 100
#define MAX_TotalNumber 1000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
struct UD {
char CName[MAX_FILENAME];
char EName[MAX_FILENAME];
};
main() {
/*讀取設定檔的變數*/
char SNmark[MAX_FILENAME];
char SN[MAX_FILENAME];
char Dmmark[MAX_FILENAME];
char Dm[MAX_FILENAME];
char DPmark[MAX_FILENAME];
char DP[MAX_FILENAME];
char UDmark[MAX_FILENAME];
struct UD UD[MAX_TotalNumber];
int TotalNum;
/*讀取設定檔config.txt,並將設定寫入變數*/
ifstream fin("config.txt");
if(!fin) {
cout << "無法讀入檔案\n";
return 1;
}
fin >> SNmark;
fin >> SN;
fin >> Dmmark;
fin >> Dm;
fin >> DPmark;
fin >> DP;
fin >> UDmark;
TotalNum = 0;
//讀取中文名_帳號名
while(!fin.eof()) {
fin >> UD[TotalNum].CName >> UD[TotalNum].EName;
TotalNum++;
if (TotalNum>=MAX_TotalNumber) {
cout <<"\n警告!!讀取名稱與對應IP資料數超過1000!!\n需修改原始碼MAX_TotalNumber並重新編譯!!\n";
}
}
fin.close();
/*產生 學校名稱_GoogleUserAdd.csv*/
char chFileName[MAX_FILENAME];
FILE * fp;
int i;
sprintf(chFileName, "%s_GoogleUserAdd.csv",SN);
fp = fopen(chFileName, "w");
fprintf(fp, "First Name [Required],Last Name [Required],Email Address [Required],Password [Required],Password Hash Function [UPLOAD ONLY],Org Unit Path [Required],New Primary Email [UPLOAD ONLY],Recovery Email,Home Secondary Email,Work Secondary Email,Recovery Phone [MUST BE IN THE E.164 FORMAT],Work Phone,Home Phone,Mobile Phone,Work Address,Home Address,Employee ID,Employee Type,Employee Title,Manager Email,Department,Cost Center,Building ID,Floor Name,Floor Section,Change Password at Next Sign-In,New Status [UPLOAD ONLY]\n");
for(i=0;i<=TotalNum-1;i++) {
/*依中文名_帳號名(對應總數需小於等於1000)*/
fprintf(fp, "%s,%s,%s%s,%s,,,/,,,,,,,,,,,,,,,,,,,,False,\n",UD[i].CName,SN,UD[i].EName,Dm,DP);
}
fclose(fp);
return 0;
}
檔案下載
資料來源:
1.利用C++程式產生的bat來一鍵設定電腦教室的電腦為固定ip或dhcp
沒有留言:
張貼留言